what is the main difference between c and c++?
Answer Posted / deepesh kumar prajapati
The main difference b/w c and c++ is that " in 'c' language
we declaration any variable after main () compulsory but in
c++ any variable declaration wherever "
for ex:-
in 'c' program eg.
#include<stdio.h>
void main()
{
int a,b;
printf("enter any no.=");
scanf("%d",&a);
b=a*a;
printf("square is=%d",b);
}
In c++ eg.
#include<iostream.h>
void main()
{
int a;
cout<<"enter any no";
cin>>a;
int b=a*a;
cout<<"square is="<<b;
}
note;-
both program is same (square any no.) only difference
is first program b is declare after main() an second program
b is declared after scan value.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does and I oop mean?
What is the difference between static polymorphism and dynamic polymorphism?
Can main method override?
Why do we use class in oops?
What is for loop and its syntax?
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
What is protected in oop?
What is the main purpose of inheritance law?
What is encapsulation in oop?
What is destructor example?
What is encapsulation in oops?
Why do we need oop?
Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.
What is difference between inheritance and polymorphism?
What is class and object in oops?