#include <stdio.h>
int main() {
int a[] = {1, 2};
int * b = a;
printf("%d %d\n", *b, b[1]);
return 0;
}
9. Input/output
#include <stdio.h>
unsigned long strlen(const char * s) {
unsigned long l = 0;
while (*s++) ++l;
return l;
}
int main() {
int a, n;
char s[12];
printf("Enter a word and a number:\n");
n = scanf("%s %d", s, &a);
if (n == 2) {
printf("word length * number value = %lu\n", strlen(s) * a);
} else {
printf("missing value!\n");
}
return 0;
}
15. int, short, char
#include <stdio.h>
int main() {
char c = '*', d = 127;
unsigned char e = d + 1;
int i = c, j = 0x1002A;
short s = j;
printf("%i %i %i %u\n", i, j, s, e);
}