+ 2
What will be the output???
#include<iostream> using namespace std; int main() { char *s = "c++"; cout<<s<<" "; s++; cout<<s<<" "; }
7 Respostas
+ 7
#include <iostream>
using namespace std;
//change void main () to int main (void)
int main (void){
char *s ="c++";
/*
Interpreting as char array
s[0] = 'c'
s[1] = '+'
s[2] = '+'
*/
cout<<s<<" "; //prints the entire char array ie "c++"
/*
by default s points to the first character in the char array ie s[0]
s++ moves the pointer to the next character in the char array ie s[1]
*/
s++;
cout<<s<<" "; //prints "++"
}
+ 7
it will show an error.....you are trying to store string in char....
+ 7
void main đ
+ 6
Your code has no meaning at all.
+ 5
hmmm jay is right...
change it to int main and return 0
+ 4
ok guyss... changed void to int
+ 3
So the answer will be "c++ ++" ??