`char` — C Keyword
`char` — C Keyword
The char keyword in C: the basic character type, one byte wide.
`char` — C Keyword
The char keyword in C: the basic character type, one byte wide.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
char (C)The basic character type, exactly one byte wide (sizeof(char) == 1 by definition). May be signed or unsigned; depends on the implementation.
char c;
char c = 'A';
const char* s = "hello";
signed char sc;
unsigned char uc;
#include <stdio.h>
#include <ctype.h>
int main(void) {
char c = 'H';
printf("%c (ASCII %d)\n", c, c); /* H (ASCII 72) */
/* Iterate a C string */
const char* word = "hello";
for (int i = 0; word[i] != '\0'; ++i) {
printf("%c", (char)toupper((unsigned char)word[i]));
}
printf("\n"); /* HELLO */
return 0;
}
unsigned char before passing char to <ctype.h> functions to avoid undefined behavior on negative values.unsigned char.charint main() {
// Pick one facility from this reference page.
// Write the smallest program that exercises its main precondition,
// complexity rule, or lifetime constraint before scaling up.
return 0;
}