Skip to content

Instantly share code, notes, and snippets.

😇
Hi, there!

Sutirtha Chakraborty sutirthaC97

😇
Hi, there!
Block or report user

Report or block sutirthaC97

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sutirthaC97
sutirthaC97 / function-pointer-example.c
Created Apr 10, 2017
Function pointer example in C.
View function-pointer-example.c
#include <stdio.h>
void say(char* s){
printf("%s",s);
}
int main()
{
void (*say_ptr)(char* s) = &say;
say("\nHello!");
@sutirthaC97
sutirthaC97 / enum-example.c
Created Apr 9, 2017
Enum example in C program.
View enum-example.c
#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.
View typedef-example.c
#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);
@sutirthaC97
sutirthaC97 / datatypes-example.c
Last active Apr 9, 2017 — forked from anonymous/datatypes-example.c
An example C program demonstrating different data types, their variables and their naming conventions.
View datatypes-example.c
/*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';
@sutirthaC97
sutirthaC97 / preprocessor-example.c
Created Apr 9, 2017
An example of a C program where preprocessor directive #define and the mathematical function pow are employed.
View preprocessor-example.c
/*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);
@sutirthaC97
sutirthaC97 / HelloWorld.c
Created Apr 9, 2017
Hello World program
View HelloWorld.c
#include <stdio.h>
int main()
{
printf("Hello World!");
return 0;
}
You can’t perform that action at this time.