Bim Studies
Quick Search
Post 1st-semester

C Practical Projects

July 20, 2023
Support Us Source Suggest Edit
Link copied to clipboard!
B
S
Verified Content BimStudies Open Source Library

More to Explore

Hand-picked related content for you.

Browse All →
Post Jul 2

Notes of C programming

Below we have presented the complete notes of c programming for the beginner’s. 100+ Programs of C programming

Post Aug 3

Unit-2 Perspectives and Evaluation Of Management

Post Jul 28

Unit:2 Basic Elements Of C

C Standards Before standardization of c several compiler like turbo c or gcc compiler gives different output of same c program. Then what the solution is? The solution is the c standard that have to follow by all the compilers and produce same result. The latest C standard was released in June 2018 which is ISO/IEC 9899:2018 also known as the C11. The main() function’s void return type − See the following program − void main() {    //program code } This program will run ok if we use the turbo c compiler but other compilers throw an error that the main cannot be void. So, which one is correct? The answer is mentioned in the standards. Here are the standardization period of C language: Escape Sequence Variables, Data types and constants/literal In C programming, variables, data types, and constants are fundamental concepts used to store and manipulate data. Let’s take a closer look at each of them: data_type variable_name; eg : int age; 2. Data Types: Data types in C specify the type of data that a variable can hold. The C language provides several built-in data types, which can be categorized into four primary categories: a. Integer Types: Used for whole numbers. b. Floating-Point Types: Used for real numbers with fractional parts. c. Character Type: 3. Constants In C, constants are fixed values that remain unchanged during the execution of a program. They are used to represent data that should not be modified or modified only under specific conditions. The const keyword is used to declare a constant variable, which means its value cannot be modified after initialization. It is often used to define numeric or character constants. Example: const int MAX_LENGTH = 100; const float PI = 3.14159; const char NEWLINE = '\n'; Comments Comments in C are used to provide explanatory notes within the source code. They are entirely ignored by the compiler and have no effect on the program’s execution. There are mainly two types of comments in c and they are: Single-line comments: To create a single-line comment, you use two forward slashes // followed by the comment text. Everything after the // on that line is treated as a comment and is not processed by the compiler. Example: //bimstudies.com Multi-line comments: Multi-line comments, also known as block comments, are used to write comments that span multiple lines. You enclose the comment text between /* and */. Everything between these symbols, including line breaks, is treated as a comment and is ignored by the compiler. Example: /*bimstudies.com*/ Library Functions and Preprocessor Directives Library functions and the preprocessor are essential components that aid in code organization, reusability, and efficiency. They offer a wide range of functionality, such as mathematical operations, string manipulation, file handling, memory management, and more Example of using a library function: #include <stdio.h> #include <conio.h> void main() { int num; printf(“Enter a number: “); scanf(“%d”, &num); // Using the scanf() function from stdio.h to read input printf(“The number you entered is: %d\n”, num); // Using printf() to display output getch(); } Preprocessor Directives: The preprocessor is a part of the C compiler that performs text processing before the actual compilation of the code begins. Preprocessor directives start with the # symbol, and they are used to instruct the preprocessor to perform specific actions, such as including header files, defining macros, conditional compilation, and more. Common preprocessor directives:

Discussion 0

Join the Conversation

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

Navigator

Jump to Section

Navigator

Jump to Section