Skip to content
KnowledgeCity

Conditional Statements in C Programming

Learn how to store data in variables and how to write and execute statements
Preview the first lesson free — get full access to all 4 lessons.
Course: On-Demand
Beginner Provider Mike McMillan  4 Lessons ·  21m  in Arabic, German, English, Spanish, French, Portuguese, Chinese 

Course Description

The first skill most programmers learn is how to use variables in their programming language of choice, since computing usually involves working with data. The C language has specific rules for creating and using variables, which might be familiar to programmers who’ve used another language, but can confuse someone who’s brand new to programming. For example, variable names have to start with an alphabetic character and can contain numbers, but not symbols—unlike some of the more popular scripting languages, C variables must be declared before use so the compiler can keep track of the variable’s data type.

These lessons on Conditional Statements discuss how to create and use variables to store data, how to use constants to create unchangeable variables, and how to write arithmetic statements for performing mathematic equations. We’ll also go over declaring variables, assigning data to variables, and combining declaration and storing data into a single statement.

What You'll Learn

  • Declare variables according to C's rules for creating and using variables
  • Assign data to variables and combine declaration and storing into a single statement
  • Use constants to create unchangeable variables
  • Write arithmetic statements for performing mathematic equations
  • Write simple if statements and if-else statements
  • Apply if-else if statements and switch statements

Key Takeaways

  • In C, variable names must start with an alphabetic character and can contain numbers but not symbols.
  • C variables must be declared before use so the compiler can keep track of the variable's data type.
  • Constants are used to create unchangeable variables, while arithmetic statements perform mathematic equations.
  • The course covers conditional statements including simple if, if-else, if-else if, and switch statements.
  • Declaring a variable and storing data into it can be combined into a single statement.

Frequently Asked Questions

What does this course cover?

It covers how to create and use variables to store data, how to use constants to create unchangeable variables, how to write arithmetic statements for performing equations, and conditional statements such as simple if, if-else, if-else if, and switch statements.

What will I learn about variables in C?

You will learn how to declare variables, assign data to variables, and combine declaration and storing data into a single statement, following C's specific rules for creating and using variables.

Who is this course suited for?

It is suited for those learning C, including programmers familiar with another language as well as those brand new to programming, since it explains C's specific rules for variables that can confuse newcomers.

What conditional statement topics are included in the lessons?

The lessons cover Simple If Statements, If-Else Statements, If-Else If Statements, and the Switch Statement.

What skills does this course help develop?

It helps develop skills in C and C-based programming languages, conditional compilation, conditional expressions, conditional statements, and interactive C.