I posted this code on another forum and was blasted because it is supposedly not C, but C++. Can someone please show me wherein this code is not legitimate C code? I dont' see it.
Thanks in advance.Code:#include <stdio.h> int main(unsigned char *argv[], int argc) { //declare two integers and load them with unique values int x = 5; int y = 3; //report the pre-algorithm values to the user printf("before:\n"); printf("x = %d\n", x); printf("y = %d\n", y); //the 1st variable now holds the sum of both integers (x = 5 + 3 or x = 8) x = x + y; //the 2nd variable now holds the result of subtracting its original value from the sum //(y = 8 - 3 or y = 5) y = x - y; //the 1st variable now holds the result of subtracting its 2nd variable from the sum //(x = 8 - 5 or x = 3) x = x - y; //report the post-algorithm values to the user printf("after:\n"); printf("x = %d\n", x); printf("y = %d\n", y); }



LinkBack URL
About LinkBacks


