Tutorials Class - Logo

  • C All Exercises & Assignments

Write a C program to check whether a number is even or odd

Description:

Write a C program to check whether a number is even or odd.

Note: Even number is divided by 2 and give the remainder 0 but odd number is not divisible by 2 for eg. 4 is divisible by 2 and 9 is not divisible by 2.

Conditions:

  • Create a variable with name of number.
  • Take value from user for number variable.

Enter the Number=9 Number is Odd.

Write a C program to swap value of two variables using the third variable.

You need to create a C program to swap values of two variables using the third variable.

You can use a temp variable as a blank variable to swap the value of x and y.

  • Take three variables for eg. x, y and temp.
  • Swap the value of x and y variable.

Write a C program to check whether a user is eligible to vote or not.

You need to create a C program to check whether a user is eligible to vote or not.

  • Minimum age required for voting is 18.
  • You can use decision making statement.

Enter your age=28 User is eligible to vote

Write a C program to check whether an alphabet is Vowel or Consonant

You need to create a C program to check whether an alphabet is Vowel or Consonant.

  • Create a character type variable with name of alphabet and take the value from the user.
  • You can use conditional statements.

Enter an alphabet: O O is a vowel.

Write a C program to find the maximum number between three numbers

You need to write a C program to find the maximum number between three numbers.

  • Create three variables in c with name of number1, number2 and number3
  • Find out the maximum number using the nested if-else statement

Enter three numbers: 10 20 30 Number3 is max with value of 30

Write a C program to check whether number is positive, negative or zero

You need to write a C program to check whether number is positive, negative or zero

  • Create variable with name of number and the value will taken by user or console
  • Create this c program code using else if ladder statement

Enter a number : 10 10 is positive

Write a C program to calculate Electricity bill.

You need to write a C program to calculate electricity bill using if-else statements.

  • For first 50 units – Rs. 3.50/unit
  • For next 100 units – Rs. 4.00/unit
  • For next 100 units – Rs. 5.20/unit
  • For units above 250 – Rs. 6.50/unit
  • You can use conditional statements.

Enter the units consumed=278.90 Electricity Bill=1282.84 Rupees

Write a C program to print 1 to 10 numbers using the while loop

You need to create a C program to print 1 to 10 numbers using the while loop

  • Create a variable for the loop iteration
  • Use increment operator in while loop

1 2 3 4 5 6 7 8 9 10

  • C Exercises Categories
  • C Top Exercises
  • C Decision Making

"Hello World!" in C Easy C (Basic) Max Score: 5 Success Rate: 85.70%

Playing with characters easy c (basic) max score: 5 success rate: 84.19%, sum and difference of two numbers easy c (basic) max score: 5 success rate: 94.56%, functions in c easy c (basic) max score: 10 success rate: 95.94%, pointers in c easy c (basic) max score: 10 success rate: 96.55%, conditional statements in c easy c (basic) max score: 10 success rate: 96.95%, for loop in c easy c (basic) max score: 10 success rate: 93.64%, sum of digits of a five digit number easy c (basic) max score: 15 success rate: 98.66%, bitwise operators easy c (basic) max score: 15 success rate: 94.82%, printing pattern using loops medium c (basic) max score: 30 success rate: 95.90%.

CodeAvail

40+ C Programming Questions For Practice: Mastering the Language in 2023

C Programming Questions For Practice

In today’s ever-changing world of technology, learning programming languages has become crucial for aspiring coders. C programming remains a popular choice in 2023 among the many languages.

C programming, created by Dennis Ritchie in the 1970s, is known for being efficient and adaptable. It forms the foundation for many other languages and helps you understand how computers work. Learning C enhances your programming abilities and prepares you for tackling more complex concepts.

In this blog, we will discuss the benefits of learning C in 2023, the challenges students face when studying the language, and provide 40+ practice questions to help you become a successful coder. 

Let’s learn the C programming questions and strengthen our C programming skills together!

What is C Programming?

Table of Contents

  • C programming is a general-purpose language developed in the 1970s.
  • It is widely used for system programming and developing applications.
  • C is known for its simplicity, efficiency, and flexibility.
  • It supports procedural programming and offers a rich set of operators and data types.
  • C programs are compiled into efficient machine code.
  • It has a large standard library for common tasks.
  • C is used for operating systems, compilers, device drivers, and applications.
  • Debugging C programs can be done using various tools.
  • Learning C provides a solid foundation for programming concepts and algorithms.

Benefits of Learning C Programming Language In 2023

c assignment questions

Here are some benefits of learning C programming language in 2023: 

1. Understand Computers Better

Learning C helps you understand how computers work. You can learn about memory, how data is stored, and how programs interact with the computer’s hardware. It is like peeking behind the scenes and discovering the inner workings of a computer.

2. Improve Your Logical Thinking

C requires thinking logically and step-by-step. You need to break down problems into smaller parts and come up with solutions. This logical thinking helps in solving problems not only in programming but also in everyday life.

3. Gain Job Opportunities

Many companies and industries still rely on C for various projects. Learning C opens up job opportunities in software development, embedded systems, and even the gaming industry. It is a valuable skill that employers look for.

4. Boost Your Confidence

Mastering a programming language like C boosts your confidence. As you gain proficiency, you will feel more capable of taking on complex coding challenges and turning your ideas into reality.

5. Fast and Efficient

C is known for being really fast and efficient. It allows you to write programs that run quickly and use computer resources well. This is important for things like making games, creating system programs, and building real-time applications where speed is important.

Challenges Faced By Students In Learning C Programming Language

Here are some challenges that students learning C programming language face: 

1. Syntax: Understanding the Rules and Structure

C has a specific syntax that needs to be followed precisely. Understanding and remembering the syntax rules can be challenging for beginners. Mixing up parentheses, semicolons, and other symbols can lead to errors in the code.

2. Conceptual Understanding

C programming involves understanding fundamental concepts such as variables, data types, loops, conditional statements, and functions. Students may find it difficult to catch these concepts initially, making writing correct and functional code difficult.

3. Memory Management: Manual Allocation and Deallocation

In C, memory management is manual, meaning that students must allocate and deallocate memory for variables and data structures. Managing memory efficiently can be complex; mistakes like memory leaks or accessing invalid memory locations can cause program crashes.

4. Debugging:  Finding and Fixing Errors

Identifying and fixing errors in the code, known as debugging, is an essential skill for programmers. However, students may struggle to locate and resolve bugs due to limited experience and understanding of the programming language.

4. Problem-solving

Writing programs require logical thinking and problem-solving skills. Students may face difficulties in breaking down complex problems into smaller, manageable steps and developing a systematic approach to solving them using C programming.

5. Lack of Practical Experience

Programming is a skill that improves with practice. Students find applying theoretical knowledge to practical scenarios challenging without practice and real-world applications. Building projects and solving programming exercises can help overcome this challenge.

To overcome these challenges, we will provide 40+ C programming questions for practice. These questions are for beginners to advanced-level coders.

Let’s practice C programming questions to become successful coders in 2023.

40+ C Programming Questions For Practice To Become A Successful Coder In 2023

Here are some C programming questions for practice to become a successful coder in 2023, whether you are a beginner or experienced coder: 

Basic Concepts

  • Write a program to find the ASCII value of a character.
  • Write a program to convert Fahrenheit to Celsius.
  • Write a program to calculate the area of a circle.
  • Write a program to check whether a given year is a leap year.
  • Write a program to find the sum of natural numbers up to N.
  • Write a program to find the sum of elements in an array.
  • Write a program to find the average of elements in an array.
  • Write a program to find the maximum and minimum elements in an array.
  • Write a program to reverse an array.
  •  Write a program to sort elements in an array in ascending order using the bubble sort algorithm.
  •  Write a program to swap two numbers using pointers.
  •  Write a program to find the length of a string using pointers.
  •  Write a program to concatenate two strings using pointers.
  •  Write a program to reverse a string using pointers.
  •  Write a program to find the factorial of a number using pointers.
  •  Write a program to find the sum of elements in an array using pointers.
  •  Write a program to find the length of a string.
  •  Write a program to count the number of words in a string.
  •  Write a program to convert a string to uppercase.
  •  Write a program to check whether a string is a palindrome or not.
  •  Write a program to count the frequency of a character in a string.
  •  Write a program to find the factorial of a number using a recursive function.
  •  Write a program to find the GCD of two numbers using a recursive function.
  •  Write a program to check whether a number is a prime number using a function.
  •  Write a program to find the sum of digits of a number using a recursive function.
  •  Write a program to find the power of a number using a recursive function.
  •  Write a program to create a structure to represent a student with name, roll number, and marks in three subjects.
  •  Write a program to find the average marks of a student using a structure.
  •  Write a program to create a structure to represent a date with a day, month, and year.
  •  Write a program to find the difference between two dates using structures.
  •  Write a program to create a structure representing a complex number and perform addition and subtraction.

File Handling

  •  Write a program to read and display the contents of a text file.
  •  Write a program to count the number of words, lines, and characters in a text file.
  •  Write a program to copy the contents of one file to another.
  •  Write a program to append text to an existing file.
  •  Write a program that reads a text file containing a list of names (one name per line) and displays the names in alphabetical order.
  •  Write a program to calculate the nth Fibonacci number using recursion.
  •  Write a program to find the factorial of a number using recursion without using the ‘*’ operator.
  •  Write a program to compute the sum of digits of a number using recursion.
  •  Using recursion, write a program to find the GCD ( Greatest Common Divisor ) of two numbers.
  •  Write a program to reverse a string using recursion.

Conclusion 

We discussed various concepts of  C programming, starting with the meaning of  C programming benefits to learning C programming language in 2023. Moreover, we also discussed how learning C can help you understand computers better and how it can be useful in different areas of programming. 

In addition, we also mentioned some challenges that students may face while learning C. To help you improve your skills, we provided 40+ practice questions. By practicing regularly and overcoming these challenges, you can become a successful coder in 2023. So, keep practicing and enjoy your journey towards mastering C programming!

Frequently Asked Questions

Q1. is c programming very hard.

The difficulty of C programming varies from person to person. It can be challenging for beginners due to its low-level nature and need for precise syntax. However, with dedication and practice, many find it manageable and even enjoyable.

Q2. Is 3 Months Enough For Coding?

Well, 3 months can be a sufficient timeframe to learn coding basics and build some foundational skills, especially if you’re dedicated and focused. However, mastery and proficiency in coding typically require continuous learning and practice over a longer period.

Q3. Is C The Fastest Language?

C is considered one of the fastest programming languages due to its low-level nature and minimal runtime overhead. However, the speed of a program also depends on how it’s written and optimized, so other languages can be just as fast or even faster in certain scenarios with proper optimization.

Related Posts

8 easiest programming language to learn for beginners.

There are so many programming languages you can learn. But if you’re looking to start with something easier. We bring to you a list of…

10 Online Tutoring Help Benefits

Do you need a computer science assignment help? Get the best quality assignment help from computer science tutors at affordable prices. They always presented to help…

Sharp Tutorial

Java Script

  • Python Programs
  • Java Script Program
  • Java Program
  • Ask Your Question
  • Java Script FAQ
  • CBSE Comp Science Question Paper
  • MDU python question Papers
  • Java Assignment
  • C Assignment
  • Python assignment
  • Java Script Assignment
  • Python Interview Question
  • Video Tutorials
  • 11th,12th Class Python Syllabus CBSE Board
  • ICSE Board 11-12 Computer Syllabus
  • Top 10 Programming Language 2020

Learn C practically and Get Certified .

Popular Tutorials

Popular examples, reference materials, learn c interactively.

The best way to learn C programming is by practicing examples. The page contains examples on basic concepts of C programming. You are advised to take the references from these examples and try them on your own.

All the programs on this page are tested and should work on all platforms.

Want to learn C Programming by writing code yourself? Enroll in our Interactive C Course for FREE.

  • C Program to Create Pyramids and Patterns
  • C Program to Check Prime Number
  • C Program to Check Palindrome Number
  • C Program to Print Hello World
  • C "Hello, World!" Program
  • C Program to Print an Integer (Entered by the User)
  • C Program to Add Two Integers
  • C Program to Multiply Two Floating-Point Numbers
  • C Program to Find ASCII Value of a Character
  • C Program to Compute Quotient and Remainder
  • C Program to Find the Size of int, float, double and char
  • C Program to Demonstrate the Working of Keyword long
  • C Program to Swap Two Numbers
  • C Program to Check Whether a Number is Even or Odd
  • C Program to Check Whether a Character is a Vowel or Consonant
  • C Program to Find the Largest Number Among Three Numbers
  • C Program to Find the Roots of a Quadratic Equation
  • C Program to Check Leap Year
  • C Program to Check Whether a Number is Positive or Negative
  • C Program to Check Whether a Character is an Alphabet or not
  • C Program to Calculate the Sum of Natural Numbers
  • C Program to Find Factorial of a Number
  • C Program to Generate Multiplication Table
  • C Program to Display Fibonacci Sequence
  • C Program to Find GCD of two Numbers
  • C Program to Find LCM of two Numbers
  • C Program to Display Characters from A to Z Using Loop
  • C Program to Count Number of Digits in an Integer
  • C Program to Reverse a Number
  • C Program to Calculate the Power of a Number
  • C Program to Check Whether a Number is Palindrome or Not
  • C Program to Check Whether a Number is Prime or Not
  • C Program to Display Prime Numbers Between Two Intervals
  • C Program to Check Armstrong Number
  • C Program to Display Armstrong Number Between Two Intervals
  • C Program to Display Factors of a Number
  • C Program to Make a Simple Calculator Using switch...case
  • C Program to Display Prime Numbers Between Intervals Using Function
  • C Program to Check Prime or Armstrong Number Using User-defined Function
  • C Program to Check Whether a Number can be Expressed as Sum of Two Prime Numbers
  • C Program to Find the Sum of Natural Numbers using Recursion
  • C Program to Find Factorial of a Number Using Recursion
  • C Program to Find G.C.D Using Recursion
  • C Program to Convert Binary Number to Decimal and vice-versa
  • C Program to Convert Octal Number to Decimal and vice-versa
  • C Program to Convert Binary Number to Octal and vice-versa
  • C Program to Reverse a Sentence Using Recursion
  • C program to calculate the power using recursion
  • C Program to Calculate Average Using Arrays
  • C Program to Find Largest Element in an Array
  • C Program to Calculate Standard Deviation
  • C Program to Add Two Matrices Using Multi-dimensional Arrays
  • C Program to Multiply Two Matrices Using Multi-dimensional Arrays
  • C Program to Find Transpose of a Matrix
  • C Program to Multiply two Matrices by Passing Matrix to a Function
  • C Program to Access Array Elements Using Pointer
  • C Program Swap Numbers in Cyclic Order Using Call by Reference
  • C Program to Find Largest Number Using Dynamic Memory Allocation
  • C Program to Find the Frequency of Characters in a String
  • C Program to Count the Number of Vowels, Consonants and so on
  • C Program to Remove all Characters in a String Except Alphabets
  • C Program to Find the Length of a String
  • C Program to Concatenate Two Strings
  • C Program to Copy String Without Using strcpy()
  • C Program to Sort Elements in Lexicographical Order (Dictionary Order)
  • C Program to Store Information of a Student Using Structure
  • C Program to Add Two Distances (in inch-feet system) using Structures
  • C Program to Add Two Complex Numbers by Passing Structure to a Function
  • C Program to Calculate Difference Between Two Time Periods
  • C Program to Store Information of Students Using Structure
  • C Program to Store Data in Structures Dynamically
  • C Program to Write a Sentence to a File
  • C Program to Read the First Line From a File
  • C Program to Display its own Source Code as Output
  • C Program to Print Pyramids and Patterns

Browse Course Material

Course info, instructors.

  • Daniel Weller
  • Sharat Chikkerur

Departments

  • Electrical Engineering and Computer Science

As Taught In

  • Programming Languages
  • Software Design and Engineering

Learning Resource Types

Practical programming in c, course description.

Photograph of two stacks of movies.

CProgramming Tutorial

  • C Programming Tutorial
  • C - Overview
  • C - Features
  • C - History
  • C - Environment Setup
  • C - Program Structure
  • C - Hello World
  • C - Compilation Process
  • C - Comments
  • C - Keywords
  • C - Identifiers
  • C - User Input
  • C - Basic Syntax
  • C - Data Types
  • C - Variables
  • C - Integer Promotions
  • C - Type Conversion
  • C - Constants
  • C - Literals
  • C - Escape sequences
  • C - Format Specifiers
  • C - Storage Classes
  • C - Operators
  • C - Decision Making
  • C - While loop
  • C - Functions
  • C - Scope Rules
  • C - Pointers
  • C - Strings
  • C - Structures
  • C - Bit Fields
  • C - Typedef
  • C - Input & Output
  • C - File I/O
  • C - Preprocessors
  • C - Header Files
  • C - Type Casting
  • C - Error Handling
  • C - Recursion
  • C - Variable Arguments
  • C - Memory Management
  • C - Command Line Arguments
  • C Programming Resources
  • C - Questions & Answers
  • C - Quick Guide
  • C - Useful Resources
  • C - Discussion
  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary

Assignment Operators in C

In C, the assignment operator stores a certain value in an already declared variable. A variable in C can be assigned the value in the form of a literal, another variable or an expression. The value to be assigned forms the right hand operand, whereas the variable to be assigned should be the operand to the left of = symbol, which is defined as a simple assignment operator in C. In addition, C has several augmented assignment operators.

The following table lists the assignment operators supported by the C language −

Simple assignment operator (=)

The = operator is the most frequently used operator in C. As per ANSI C standard, all the variables must be declared in the beginning. Variable declaration after the first processing statement is not allowed. You can declare a variable to be assigned a value later in the code, or you can initialize it at the time of declaration.

You can use a literal, another variable or an expression in the assignment statement.

Once a variable of a certain type is declared, it cannot be assigned a value of any other type. In such a case the C compiler reports a type mismatch error.

In C, the expressions that refer to a memory location are called "lvalue" expressions. A lvalue may appear as either the left-hand or right-hand side of an assignment.

On the other hand, the term rvalue refers to a data value that is stored at some address in memory. A rvalue is an expression that cannot have a value assigned to it which means an rvalue may appear on the right-hand side but not on the left-hand side of an assignment.

Variables are lvalues and so they may appear on the left-hand side of an assignment. Numeric literals are rvalues and so they may not be assigned and cannot appear on the left-hand side. Take a look at the following valid and invalid statements −

Augmented assignment operators

In addition to the = operator, C allows you to combine arithmetic and bitwise operators with the = symbol to form augmented or compound assignment operator. The augmented operators offer a convenient shortcut for combining arithmetic or bitwise operation with assignment.

For example, the expression a+=b has the same effect of performing a+b first and then assigning the result back to the variable a.

Similarly, the expression a<<=b has the same effect of performing a<<b first and then assigning the result back to the variable a.

Here is a C program that demonstrates the use of assignment operators in C:

When you compile and execute the above program, it produces the following result −

Codeforwin

Pointer programming exercises and solutions in C

Pointer is a variable that stores memory addresses. Unlike normal variables it does not store user given or processed value, instead it stores valid computer memory address.

Pointer allows various magical things to be performed in C.

  • Pointers are more efficient in handling arrays and structures.
  • Pointers are used to return multiple values from a function.
  • Pointer allows dynamic memory allocation and deallocation (creation and deletion of variables at runtime) in C. Which undoubtedly is the biggest advantage of pointers.
  • Pointer allows to refer and pass a function as a parameter to functions.

and many more…

For beginners pointers can be a bad dream if not practiced well. However, once mastered you can do anything you want to do in C programming language.

In this exercise I will cover most of the pointer related topics from a beginner level. Always feel free to drop your queries and suggestion down below in the comments section .

Pointer to Pointer (Double pointer) memory representation

Required knowledge

Pointers , Pointer Arithmetic , Pointer to Pointer , Pointer and Arrays , Function Pointer

Please go through above tutorials to get a good grasp of following examples.

List of pointer programming exercises

  • Write a C program to create, initialize and use pointers .
  • Write a C program to add two numbers using pointers .
  • Write a C program to swap two numbers using pointers .
  • Write a C program to input and print array elements using pointer .
  • Write a C program to copy one array to another using pointers .
  • Write a C program to swap two arrays using pointers .
  • Write a C program to reverse an array using pointers .
  • Write a C program to search an element in array using pointers .
  • Write a C program to access two dimensional array using pointers .
  • Write a C program to add two matrix using pointers .
  • Write a C program to multiply two matrix using pointers .
  • Write a C program to find length of string using pointers .
  • Write a C program to copy one string to another using pointers .
  • Write a C program to concatenate two strings using pointers .
  • Write a C program to compare two strings using pointers .
  • Write a C program to find reverse of a string using pointers .
  • Write a C program to sort array using pointers .
  • Write a C program to return multiple value from function using pointers .

Master Programming

C Programming Exercises With Solutions (PDF)

Here you will get C Programming Exercises With Solutions.

Here I am going to provide you a document of these, which you can download and make changes according to your own.

C Programming Exercises With Solutions

Download C Programming Practical Assignments Questions

Download Now

Download C Programming Exercises With Solutions PDF (2020)

Download c programming exercises with solutions pdf (2021), download 100+ c programming exercises pdf.

If you face any problem in downloading C Programming Practical Assignments Questions and Solutions PDFs, then tell us in the comment below and you will definitely share this post with your friends so that they can also be of some help.

Also Read -:

  • Database Management System Lab Assignment Exercise Question and There Solutions
  • C++ Lab Exercises And Solutions (PDF) – Master Programming
  • Web Technology Lab Assignment Question And Solutions
  • Pc Software Practical Assignment Question And Solutions
  • Operating System with Linux Lab Assignment Question And Solutions (PDF)

' src=

Jeetu Sahu is A Web Developer | Computer Engineer | Passionate about Coding and Competitive Programming

C Data Types

C operators.

  • C Input and Output
  • C Control Flow
  • C Functions
  • C Preprocessors

C File Handling

  • C Cheatsheet

C Interview Questions

Related Articles

  • Solve Coding Problems
  • C Programming Language Tutorial
  • C Language Introduction
  • Features of C Programming Language
  • C Programming Language Standard
  • C Hello World Program
  • Compiling a C Program: Behind the Scenes
  • Tokens in C
  • Keywords in C

C Variables and Constants

  • C Variables
  • Constants in C
  • Const Qualifier in C
  • Different ways to declare variable as constant in C
  • Scope rules in C
  • Internal Linkage and External Linkage in C
  • Global Variables in C
  • Data Types in C
  • Literals in C
  • Escape Sequence in C
  • Integer Promotions in C
  • Character Arithmetic in C
  • Type Conversion in C

C Input/Output

  • Basic Input and Output in C
  • Format Specifiers in C
  • printf in C
  • Scansets in C
  • Formatted and Unformatted Input/Output functions in C with Examples
  • Operators in C
  • Arithmetic Operators in C
  • Unary operators in C
  • Relational Operators in C
  • Bitwise Operators in C
  • C Logical Operators

Assignment Operators in C

  • Increment and Decrement Operators in C
  • Conditional or Ternary Operator (?:) in C
  • sizeof operator in C
  • Operator Precedence and Associativity in C

C Control Statements Decision-Making

  • Decision Making in C (if , if..else, Nested if, if-else-if )
  • C - if Statement
  • C if...else Statement
  • C if else if ladder
  • Switch Statement in C
  • Using Range in switch Case in C
  • while loop in C
  • do...while Loop in C
  • For Versus While
  • Continue Statement in C
  • Break Statement in C
  • goto Statement in C
  • User-Defined Function in C
  • Parameter Passing Techniques in C
  • Function Prototype in C
  • How can I return multiple values from a function?
  • main Function in C
  • Implicit return type int in C
  • Callbacks in C
  • Nested functions in C
  • Variadic functions in C
  • _Noreturn function specifier in C
  • Predefined Identifier __func__ in C
  • C Library math.h Functions

C Arrays & Strings

  • Properties of Array in C
  • Multidimensional Arrays in C
  • Initialization of Multidimensional Array in C
  • Pass Array to Functions in C
  • How to pass a 2D array as a parameter in C?
  • What are the data types for which it is not possible to create an array?
  • How to pass an array by value in C ?
  • Strings in C
  • Array of Strings in C
  • What is the difference between single quoted and double quoted declaration of char array?
  • C String Functions
  • Pointer Arithmetics in C with Examples
  • C - Pointer to Pointer (Double Pointer)
  • Function Pointer in C
  • How to declare a pointer to a function?
  • Pointer to an Array | Array Pointer
  • Difference between constant pointer, pointers to constant, and constant pointers to constants
  • Pointer vs Array in C
  • Dangling, Void , Null and Wild Pointers in C
  • Near, Far and Huge Pointers in C
  • restrict keyword in C

C User-Defined Data Types

  • C Structures
  • dot (.) Operator in C
  • Structure Member Alignment, Padding and Data Packing
  • Flexible Array Members in a structure in C
  • Bit Fields in C
  • Difference Between Structure and Union in C
  • Anonymous Union and Structure in C
  • Enumeration (or enum) in C

C Storage Classes

  • Storage Classes in C
  • extern Keyword in C
  • Static Variables in C
  • Initialization of static variables in C
  • Static functions in C
  • Understanding "volatile" qualifier in C | Set 2 (Examples)
  • Understanding "register" keyword in C

C Memory Management

  • Memory Layout of C Programs
  • Dynamic Memory Allocation in C using malloc(), calloc(), free() and realloc()
  • Difference Between malloc() and calloc() with Examples
  • What is Memory Leak? How can we avoid?
  • Dynamic Array in C
  • How to dynamically allocate a 2D array in C?
  • Dynamically Growing Array in C

C Preprocessor

  • C Preprocessor Directives
  • How a Preprocessor works in C?
  • Header Files in C
  • What’s difference between header files "stdio.h" and "stdlib.h" ?
  • How to write your own header file in C?
  • Macros and its types in C
  • Interesting Facts about Macros and Preprocessors in C
  • # and ## Operators in C
  • How to print a variable name in C?
  • Multiline macros in C
  • Variable length arguments for Macros
  • Branch prediction macros in GCC
  • typedef versus #define in C
  • Difference between #define and const in C?
  • Basics of File Handling in C
  • C fopen() function with Examples
  • EOF, getc() and feof() in C
  • fgets() and gets() in C language
  • fseek() vs rewind() in C
  • What is return type of getchar(), fgetc() and getc() ?
  • Read/Write Structure From/to a File in C
  • C Program to print contents of file
  • C program to delete a file
  • C Program to merge contents of two files into a third file
  • What is the difference between printf, sprintf and fprintf?
  • Difference between getc(), getchar(), getch() and getche()

Miscellaneous

  • time.h header file in C with Examples
  • Input-output system calls in C | Create, Open, Close, Read, Write
  • Signals in C language
  • Program error signals
  • Socket Programming in C
  • _Generics Keyword in C
  • Multithreading in C
  • C Programming Interview Questions (2024)
  • Commonly Asked C Programming Interview Questions | Set 1
  • Commonly Asked C Programming Interview Questions | Set 2
  • Commonly Asked C Programming Interview Questions | Set 3

c assignment questions

Assignment operators are used for assigning value to a variable. The left side operand of the assignment operator is a variable and right side operand of the assignment operator is a value. The value on the right side must be of the same data-type of the variable on the left side otherwise the compiler will raise an error.

Different types of assignment operators are shown below:

1. “=”: This is the simplest assignment operator. This operator is used to assign the value on the right to the variable on the left. Example: a = 10; b = 20; ch = 'y';

2. “+=” : This operator is combination of ‘+’ and ‘=’ operators. This operator first adds the current value of the variable on left to the value on the right and then assigns the result to the variable on the left. Example: (a += b) can be written as (a = a + b) If initially value stored in a is 5. Then (a += 6) = 11.

3. “-=” This operator is combination of ‘-‘ and ‘=’ operators. This operator first subtracts the current value of the variable on left from the value on the right and then assigns the result to the variable on the left. Example: (a -= b) can be written as (a = a - b) If initially value stored in a is 8. Then (a -= 6) = 2.

4. “*=” This operator is combination of ‘*’ and ‘=’ operators. This operator first multiplies the current value of the variable on left to the value on the right and then assigns the result to the variable on the left. Example: (a *= b) can be written as (a = a * b) If initially value stored in a is 5. Then (a *= 6) = 30.

5. “/=” This operator is combination of ‘/’ and ‘=’ operators. This operator first divides the current value of the variable on left by the value on the right and then assigns the result to the variable on the left. Example: (a /= b) can be written as (a = a / b) If initially value stored in a is 6. Then (a /= 2) = 3.

Below example illustrates the various Assignment Operators:

Please Login to comment...

  • C-Operators
  • cpp-operator
  • manshisharma13

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

Hostos Community College Library

  • Hostos Community College Library

ENG 111 Prof. Thomas Barber

  • Finding sources via Google - questions to ask
  • Your topic and key terms
  • Finding sources through the library website
  • Citation in MLA style
  • << Previous: Citation in MLA style
  • Last Updated: Feb 23, 2024 4:49 PM
  • URL: https://guides.hostos.cuny.edu/c.php?g=1383319

Library Info and Research Help | [email protected] (718) 518-4215 Loans or Fines | [email protected] (718) 518-4222 475 Grand Concourse (A Building), Room 308, Bronx, NY 10451

IMAGES

  1. NPTEL Programming in C++ Week 5

    c assignment questions

  2. Solved C Programming Assignment 9 Files, For and While Loops

    c assignment questions

  3. C Programming, Sample quiz assignment

    c assignment questions

  4. Solved Need help with this c++ assignment. Please no advance

    c assignment questions

  5. Solved Write c assignment statements for the following

    c assignment questions

  6. Assignment Operators in C Example

    c assignment questions

VIDEO

  1. C# Programming Challenge: Customer Classes Part 1 (inheritance, C# OOP, object arrays, Properties)

  2. BPAG 172 SOLVED ASSIGNMENT 2023-24 IN ENGLISH

  3. NPTEL Problem Solving Through Programming In C Week 0 Quiz Assignment Solution

  4. Assignment Operator in C Programming

  5. Case Study Question class 12 CBSE Maths

  6. Embedded Systems Design Week 2 Quiz Answer Solution

COMMENTS

  1. C programming Exercises, Practice, Solution

    C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs.

  2. C Exercises

    This C Exercise page contains the top 30 C exercise questions with solutions that are designed for both beginners and advanced programmers. It covers all major concepts like arrays, pointers, for-loop, and many more. So, Keep it Up! Solve topic-wise C exercise questions to strengthen your weak topics. C Programming Exercises

  3. C All Exercises & Assignments

    Description: You need to create a C program to swap values of two variables using the third variable. Hint: You can use a temp variable as a blank variable to swap the value of x and y. Conditions: Take three variables for eg. x, y and temp. Swap the value of x and y variable. #include <stdio.h> int main() { int x = 10; int y = 20; int temp;

  4. Solve C

    For Loop in C. Easy C (Basic) Max Score: 10 Success Rate: 93.63%. Solve Challenge. Sum of Digits of a Five Digit Number. Easy C (Basic) Max Score: 15 Success Rate: 98.66%. Solve Challenge. Bitwise Operators. Easy C (Basic) Max Score: 15 Success Rate: 94.82%. Solve Challenge. Printing Pattern Using Loops.

  5. 40+ C Programming Questions For Practice In 2023

    1. Understand Computers Better 2. Improve Your Logical Thinking 3. Gain Job Opportunities 4. Boost Your Confidence 5. Fast and Efficient Challenges Faced By Students In Learning C Programming Language 1. Syntax: Understanding the Rules and Structure 2. Conceptual Understanding 3. Memory Management: Manual Allocation and Deallocation 4.

  6. C practical assignments questions

    Sample-1 Q 1 Write a program in c to Swap two numbers by using and without using third variable. Submit Answer View Solution Q 2 Write a c program to get all roots of a quadratic equation. Submit Answer View Solution Q 3 Write C program to check given year is a leap year or not? Submit Answer View Solution

  7. PDF Elementary Programming in C Assignments

    Assignment Question Write a C program to find the area and perimeter of a circle. Write a C program that accepts the salary and age from the user and displays the same on the screen as output. Operators and Expressions Sr. No. 1 Write a program to accept and add three numbers. 2 For the following values, write a program to evaluate the expression

  8. C Examples

    Program. C Program to Print an Integer (Entered by the User) C Program to Add Two Integers. C Program to Multiply Two Floating-Point Numbers. C Program to Find ASCII Value of a Character. C Program to Compute Quotient and Remainder. C Program to Find the Size of int, float, double and char. C Program to Demonstrate the Working of Keyword long.

  9. Basic programming exercises and solutions in C

    Always feel free to drop your questions in comments section. I love to hear hugs and bugs from you all. Required knowledge. Operators, Data types, Variables and expression, Basic input/output. List of basic programming exercises. Write a C program to perform input/output of all basic data types.

  10. Top 50 C Programming Interview Questions and Answers

    C Programming Interview Questions C Programming language is one of the languages that are both complex yet important to learn for strengthening your programming skills. Interview questions can be categorized into two parts: For Freshers For Experienced

  11. Assignments

    Assignment 3: Problem 1: C++ Linked List Library (PDF) Sample Solution to Assignment 3, Problem 1. Solution and test data: cpplist (ZIP) (This ZIP file contains: 3 .h files, 4 .cpp files, 1 .make file and 1 .txt file.) **Assignment 4 (Final Project) ** Problem: N-Body Gravity Simulation (problem statement available in Lecture Notes for Lecture 8)

  12. Assignments

    Assignments | Practical Programming in C | Electrical Engineering and Computer Science | MIT OpenCourseWare Assignments This section provides the course assignments, supporting files, and solutions.

  13. Practical Programming in C

    This course provides a thorough introduction to the C programming language, the workhorse of the UNIX operating system and lingua franca of embedded processors and micro-controllers. The first two weeks will cover basic syntax and grammar, and expose students to practical programming techniques. The remaining lectures will focus on more advanced concepts, such as dynamic memory allocation ...

  14. Loop programming exercises and solutions in C

    List of loop programming exercises. Write a C program to print all natural numbers from 1 to n. - using while loop. Write a C program to print all natural numbers in reverse (from n to 1). - using while loop. Write a C program to print all alphabets from a to z. - using while loop.

  15. If else programming exercises and solutions in C

    Fundamentals C Programming Data Structures If else programming exercises and solutions in C January 15, 2023 if...else is a branching statement. It is used to take an action based on some condition. For example - if user inputs valid account number and pin, then allow money withdrawal.

  16. PDF Programming Assignments

    Programming Assignments A number is called an Armstrong number if the sum of the cubes of the digits of the number is equal to the number. For example 153 = 1^3 + 5^3 + 3^3. Write a C program that asks the user to enter a number and returns if it is Armstrong or not (use function).

  17. C Tutorial

    C is a general-purpose, procedural, high-level programming language used in the development of computer software and applications, system programming, games, web development, and more. C language was developed by Dennis M. Ritchie at the Bell Telephone Laboratories in 1972. It is a powerful and flexible language which was first developed for ...

  18. Assignment Operators in C

    In C, the assignment operator stores a certain value in an already declared variable. A variable in C can be assigned the value in the form of a literal, another variable or an expression. The value to be assigned forms the right hand operand, whereas the variable to be assigned should be the operand to the left of = symbol, which is defined as ...

  19. Pointer programming exercises and solutions in C

    Required knowledge Pointers, Pointer Arithmetic, Pointer to Pointer, Pointer and Arrays, Function Pointer Please go through above tutorials to get a good grasp of following examples. List of pointer programming exercises . . . . . . . . . . . . . . . .

  20. C Programming Exercises With Solutions (PDF)

    Download C Programming Practical Assignments Questions Download Now Download C Programming Exercises With Solutions PDF (2020) Download Now Download C Programming Exercises With Solutions PDF (2021) Download Now Download 100+ C Programming Exercises PDF Download Now

  21. What is the difference between += and =+ C assignment operators

    1 Answer. In modern C, or even moderately ancient C, += is a compound assignment operator, and =+ is parsed as two separate tokens. = and +. Punctuation tokens are allowed to be adjacent. except that x is only evaluated once (which can matter if it's a more complicated expression). and the + is a unary plus operator.

  22. Assignment Operators in C

    1. "=": This is the simplest assignment operator. This operator is used to assign the value on the right to the variable on the left. Example: a = 10; b = 20; ch = 'y'; 2. "+=": This operator is combination of '+' and '=' operators.

  23. C assignments in an 'if' statement

    Basically C evaluates expressions. In. s = data[q] The value of data[q] is the the value of expression here and the condition is evaluated based on that. The assignment. s <- data[q] is just a side-effect.

  24. Finding sources via Google

    Library Info and Research Help | [email protected] (718) 518-4215 Loans or Fines | [email protected] (718) 518-4222 475 Grand Concourse (A Building), Room 308, Bronx, NY 10451