Tuesday, March 17, 2020

Basic of c program part 1


CREATED 

C is a general-purpose, high-level language that was originally developed by Dennis M. 
Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972.

  1. Easy to learn
  2. Structured language

FIRST WE NEED NOW ABOUT DATA TYPE :

Data TypeMaximum ValueMinimum Value
int2,147,483,647- 2,147,483,648
float3.4028235E381.4E-45
double1.7976931348623157E3084.9E-324
char65,5350
short32767-32768
long9223372036854775807-9223372036854775808
INT =Is used fot number. 
eg: 
        int a;
        a=10;
like that we are using.
      
SAME AS ALL THE DATA TYPE :

FLOT= Is used for decimal point value assign 

CHAR= Is used for character assign

printf= Is used for print the output  ex: first program if you change inside the ("") with your name it will dispaly the output in your name   printf("jmsoftware\n");

# is a preprocessor directive 

stdio.h=standard input and output header file it a meaning for this line .

we see the example program :

Example 1 - C hello world program
/** My first C program */
#include <stdio.h>

int main()
{
  printf("Hello World\n");
  return 0;
}

Output of program:
"Hello World"

Example 2 - C program to get input from a user using scanf
#include <stdio.h>
int main() // the compiler start to compile at int main
{
  int x;
  printf("Input an integer\n");
  scanf("%d", &x); // %d is used for an integer
  printf("The integer is: %d\n", x);
  return 0;
}
Output:
Input an integer
7897
The integer is: 7897

No comments:

Post a Comment

cisco Cybersecurity Essentials Quiz 8 answer in bold

Question  1 Correct Mark 2.00 out of 2.00 Flag question Question text A company has had several incidents involving users downloading unauth...