Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

what is the difference between 'row++, ++row' in c language??

+4 votes
asked Oct 17, 2022 by S Madhusudhana Rao (200 points)

3 Answers

+3 votes
answered Oct 17, 2022 by Peter Minarik (86,040 points)
edited Oct 19, 2022 by Peter Minarik

row++ is called the post-increment

++row is called the pre-increment

The post-increment increments the value and returns the value before the increment.

The pre-increment increments the value and returns the value after the increment.

E.g.:

#include <stdio.h>

int main()
{
    int val = 3;
    printf("val++ = %d\n", val++); // prints 3
    printf("val = %d\n", val); // prints 4

    val = 3;
    printf("++val = %d\n", ++val); // prints 4
    printf("val = %d\n", val); // prints 4

    return 0;
}
0 votes
answered Oct 17, 2022 by Harshit Yadav (190 points)
row++ is post increament i.e the row value will be increrased after the current value  returned

++row is pre increament i.e the row value will be increased before the current value is returned
0 votes
answered Oct 18, 2022 by Ravi Rao (140 points)
#include <stdio.h>

int main()
{
    int val = 3;
    printf("val++ = %d\n", val++); // prints 3
    printf("val = %d\n", val); // prints 4

    val = 3;
    printf("++val = %d\n", ++val); // prints 4
    printf("val = %d\n", val); // prints 4

    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...