Commit fe61bee4 authored by Alan Marchiori's avatar Alan Marchiori
Browse files

added a few and minor syntax changes

parent 94317caf
int main(void)
{
double y[10];
double x;
y[0] = 3.1415926;
y[1] = 2.71828;
y[2] = 0;
y[10] = 666;
}
......@@ -9,6 +9,6 @@ int main(int argc, char* argv[]) {
printf("pi= %f\n\n", pi);
for (i=0; i<4; i++) {
printf("pf[%d]= %x\n", i, pf[i]);
printf("pf[%d]= %02hhx\n", i, pf[i]);
}
}
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
printf("hello C world\n");
int main(int argc, char* argv[])
{
printf("hello C world\n"); // from stdio.h
return EXIT_SUCCESS; // from stdlib.h
}
#include <stdio.h>
int main(void){
int i;
float x;
char text[80];
scanf("%d", &i);
scanf("%f", &x);
scanf("%s", text);
printf(" i= %d\n", i);
printf(" x= %f\n", x);
printf(" text= %s\n", text);
}
switch (i) {
case 1:
j = -i;
break;
case 2:
j += 123;
break;
case 3:
j = 999;
break;
default: {
j = 666;
}
break;
}
......@@ -5,8 +5,8 @@ int main(int argc, char* argv[]) {
int i = 7;
int j = -1;
int* pi = &i;
int* pj = &j;
int *pi = &i;
int *pj = &j;
printf(" i = %d\n", i);
printf(" j = %d\n", j);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment