Professional Documents
Culture Documents
22F-7465 Hometask
22F-7465 Hometask
22F-7465 Hometask
PROGRAMMING LAB
SUBMITTED TO :
SHAHBAZ AYYAZ
SUBMITTED BY :
HASHIR KHAN
ROLL NO :
22F-7465
DATE :
8-2-2023
Question # 1:
Firstly no value is initialized or stored in the pointer thus it will display adress of garbage
value
A pointer cannot store another pointer like this similarly there are two semicolons in the
same line before initialiization
{
char string1[80];
char string2[80];
cout << "Enter two strings: ";
{
while (*s1 != '\0')
++s1;
for (; *s1 = *s2; ++s1, ++s2);
This program is perfrorming the function of concatinating of string which means it joins two
strings and displays the output. For loop in the void function is terminated because it has
semicolon in the end
B)
#include <iostream>
int main()
char string1[80];
int x;
++x;
return x;
Question # 4:
A)
Since we have used the const with the varialble thus passing it with adress of other variables
will not change the output if the const is stored in pointer
B)
It will give error as adress of constant pointer cannot be changed
C)
Const keyword should also be used to point a char secondly we can pass the adress of other
character to the pointer and the pointer will point the modified value of that adress