C is a high-level language that was founded in 1972 at AT&T Bell Labs by Mr. Dennis
Ritchie. It is popular due to its large feature list and speed. Many operating systems,
embedded programs used for microprocessors and games are built using C language.
Even today, many consider C language to be their first language to learn coding
because of its simplicity.
When we write a C program, the program is compiled by a compiler to convert it into
machine language code, which is the code that computers can understand. Writing C
programs is easier than writing directly in machine-level language, which is usually ones
and zeros. Instead, we can write C programs, which are closer to English and then use
a compiler to convert it into machine-level language.
Core Block of a C Program
Every C program has a hash include in the angular bracket header files. All header files
contain predefined functions, which we can directly use. We can include one or more
header files. All C programs start with a fixed function name called 'main'. Every
function in C returns a value, and in this case, we are returning a value as int.
The starting curly braces and ending curly braces indicate the point from where our
main function starts and where it ends. All the lines between these parentheses are our
block of main function. Inside of our main code block, we can have declaration
statements, decision control statements, loops, call to other functions, special keywords,
and our written value.
Execution of a C Program
During the time of compilation, the compiler combines our code line by line, and when it
gets converted into machine code, that machine code is also executed line by line.
Hence, it is necessary to understand how exactly we can instruct the computer in a
stepwise manner so that we can achieve our desired output.
Format Specifiers and Basic Functions
We are going to talk about format specifiers and basic functions that are required in
order to take input from the user or to display output to the user. The commonly used
functions are printf and scanf, and we will be requiring these functions quite often.
Character Sets and Constants in C Language
The character set in C has all alphabets, digits, facial symbols, and additional ASCII
characters. Constants in C language are of two types - primary constants and
secondary constants. Primary constants in C are integer, real, and character.
Basic Data Types in C
The three basic data types in C are int, float, and char. Int is used to store whole
numbers, while float is used to store real values or values that contain decimal points.
Char is used to store characters.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller ishrathayesha. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $5.49. You're not tied to anything after your purchase.