Data Types in C

Data Types in C


Primitive Data Types in C:

1. int
2. float
3. char
4. double
5. void


Derived Data Types in C:

1. array
2. pointer
3. function


User-Defined Data Types in C:

1. structure
2. union
3. enum


#include<stdio.h>
#include<stdbool.h>

// extern variable declaration
extern int x;


int main()
{
int age = 30;
char name[] = "Embedded";
float average = 66.78;
char gender = 'M';
bool result = true;

printf("extern integer Data : %d\n",x);
printf("Integer Data : %d\n", age);
printf("String Data : %s\n", name);
printf("Float Data : %f\n", average);
printf("Character Data : %c\n", gender);
printf("Boolean Data in integer form : %d\n", result);

printf("size of int is = %u\n", sizeof(int));
printf("size of char is=%u\n", sizeof(char));
printf("size of float is=%u\n", sizeof(float));
printf("size of bool is=%u\n", sizeof(bool));

return 0;
}

int x=5; // use of extern variable at different location


Comments

Popular posts from this blog

Setting up a USB thermal printer with a Raspberry Pi 3B+

Autostart an app on reboot - Raspberry Pi

Basic Input/Output C Program