Write a function called setsmartphone which accepts a strin

Write a function called set_smartphone (), which accepts, a string, a character, an integer, and a pointer to a Smartphone. The function indirectly sets (via the pointer to the Smartphone) each component in the struct to the values passed into the function. The function does not return a value.

Solution

struct smartphone

{

string s;

char c;

int i;

}

int main()

{

struct smartphone* sp;//pointer to smartphone

set_smartphone(\"android\",\'n\',1,&sp);//passing pointer //and other values

return 0;

}

void set_smartphone(string s,char c,int i,struct smartphone* sp)

{

sp->s=s;

sp->c=c;

sp->i=i;

}

 Write a function called set_smartphone (), which accepts, a string, a character, an integer, and a pointer to a Smartphone. The function indirectly sets (via t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site