Link to home
Start Free TrialLog in
Avatar of dshrenik
dshrenikFlag for United States of America

asked on

char pointer to accept string input

Please tell me how to correct the following code:

char *s;
	scanf("%s", s);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dshrenik

ASKER

Is there any way I can have variable that adjusts its size according to the size of the input?
Thanks!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, I forgot to mention that you'll have to add these includes before you can use this:

#include <string>
#include <iostream>

Open in new window


ZOPPO