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
Can a varargs method be overloaded?
what's the basic's in dot net
What do you mean by Encapsulation?
What is an interface in oop?
What is coupling in oops?
can we make game by using c
Why do we use class in oops?
What is overriding in oop?
What is oops and its features?
What is encapsulation in ict?
What is the use of oops?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
What is a class and object?
What is a null tree?
hi all..i want to know oops concepts clearly can any1 explain??