C Programming Video Tutorials for Beginners | Variables in C with Example

#include <stdio.h>

#include <conio.h>

int main()
{
//datatype

int age ;

float weight ;

char sex ;

age = 37 ;

weight = 75.8 ;

sex = ‘M’ ;

printf(“%d %f %c”,age, weight,sex );
getch() ;

return 0 ;

}

  • //datatype  – // is a comment which compiler will ignore this line of code.
  • int age ; – age is an integer value and not character or string.
  • float weight ;
  • char sex ;
  • age = 37 ; -> assigning 37 values to variables age
  • sex = ‘M’ ; -> single quotes for character data type .
  • printf(“%d %f %c”,age, weight,sex );     -> d is for integer data type, f = floating point , c = for character
  • During compile i`m encountered issues again g++ compiler not working ….
  • Finally i found out the solution .
    • Download and Install Dev-C++ 5.4.0 if you don’t  have then download from here->Download Dev-C++ 5.4.0< wait 5 second to download(downloading source sourceforge).
This entry was posted in C and tagged . Bookmark the permalink.

Leave a comment