This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void say(char* s){ | |
printf("%s",s); | |
} | |
int main() | |
{ | |
void (*say_ptr)(char* s) = &say; | |
say("\nHello!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
enum weekdays{sun, mon, tue, wed, thu=121, fri, sat}; | |
enum weekdays sunday = sun; | |
enum weekdays friday = fri; | |
printf("sunday has the value: %d and friday: %d", sunday, friday);//Here friday has the value 122 because the previous const thu has the value of 121 whilst wed has the value of 3 because sun is initialized to zero. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef double dbl; //Now dbl can be used anywhere in the program we need to write double. | |
int main() | |
{ | |
dbl a = 21.3987; | |
printf("The value of a is : %lf ", a); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*An example C program to demonstrate different data types.*/ | |
#include <stdio.h> | |
int main() | |
{ | |
int meaningOfLife = 42; | |
float a_random_float = 56.9; | |
double pi = 3.141; | |
char c = 'c'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*C program to print area of a circle whose radius is given as input*/ | |
#include <stdio.h> | |
#include <math.h>//for the function -> pow() | |
#define pi 3.141 | |
int main(){ | |
double radius, area; | |
printf("\nEnter the value of the radius: "); | |
scanf("%lf",&radius); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
printf("Hello World!"); | |
return 0; | |
} |