Softfixx c language C Syntax and Statements

C Syntax and Statements


C Syntax and Statements

Great ! Welcome to this day as you completed the previous day. In this article you will learn C Syntax and Statements. So keep learning with us step by step.

If you wants to Learn with us online via Zoom or any other platform in live classes you can contact us on WhatsApp or telegrams +918755084148 frequently. Even we help you instantly to grow up.

C Syntax and Statements

well, if you wants to learn any language then you need to know its syntax and statements. So in this post we learn C Syntax and Statements well. Let’s make a heading plan on which we will discuss in this post one by one:

  • C Syntax
  • C Statements
  • How to print in C language
C Syntax and Statements

C Syntax ( All information of the syntax step by step)

Well, in previous post you seen this given code. Let’s understand this code well step by step here :

#include <stdio.h>

int main() {
printf(“Hello World!”);
return 0;
}

1:#include <stdio.h>
In this code #include <sdtio.h> is a header file. This is predefined library that have many functionality. Same file may be more like #include <string.h> and so more.

2: White space
Well this is used by us to make our code readable and more understanding.

3: int main() {

// code to excute }

Here int main( ) is called a main function the code written in the curly brackets { } will be executed when you run this code.

So here we can say that all our code need to write in this function.

4: printf(“Hello World!”);
In this line the printf() is a function to print the text with in brackets. Its also used to show or print output text.

Here in this code its print or show “Hello World” as an output.

Try to solve this problem:
Q1: Print the text “Welcome to Excellent Shiksha”

One more thing you need to see at the end of the line that is semicolon (;). Keep in mind every language have specific things to use in their code. Same here every statement ends with semicolon.

If you did not write it then the compiler get confused which code need to run first thats why its give an error.

5: return 0;
This is used to ends the function also it returns the output of the given code. As in this code its return the printf () data as an output.

6: Keep in mind
A: Well this is more important to open and close the function with curly brackets.

like :
int main(){
// your code to execute write here
}

B: we can write this code as below and output will be same.

int main(){printf(“Hello World!”);return 0;}

but for more readability and understanding we write it in proper format thats help us to read and understand well.

C Statements ( All information of the Statements step by step)

This is really you need to understand because this will reduce your code length and increase your code strength.

Every program has a list of “instructions” that need to be executed by compilers or by computer. In programming these instructions are called Statements.

In this code :

#include <stdio.h>

int main() {
printf(“Hello World!”);
return 0;
}

printf(“Hello World!”); is a statement to show text as an output. Every statement will be end with semicolon ;

One program may have many statements like this code :

#include <stdio.h>

int main() {
printf(“Hello World!”);
printf(“Welcome to Softfixx.com!”);
return 0;
}

In above code have two statements with printf() function. Which are as : 

  • printf(“Hello World!”);
  • printf(“Welcome to Softfixx.com!”);

How to print in C language

Well, you already seen many statements with printf(); function which give output like a result or we can say its show the text as a print. 

in every language print function may be different. Here in c language printf(“text to print write here”);  is used to show the text as an output. 

Try to solve this problem:
Q1: Try to Print your name or “Welcome to Excellent Shiksha”?

Leave a Reply

Your email address will not be published. Required fields are marked *