Alcatel Lucent Interview Question for Software Engineer / Developers


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

it's gives error because we can,t assign value in string like ptr="hello world";

- deepak kumar May 18, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

It won't give error, bcoz, we are just assigning a pointer to the first location address of the string.

- Anonymous July 03, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 2 vote

there are no errors in the program. since i have executed the same thing. we can assign values to the variables with that object (obj).

#include <stdio.h>

struct st{ 
int a; 
char *ptr; 
}obj; 

main()
{   
   obj.a=10;	
   obj.ptr="Hello World";
   printf("%d,%s",obj.a,obj.ptr);
}

- Karthik Kumar May 19, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Dynamic allocation is not possible fr char pointer, for that u need to use this procedure:
char arry[100] ; /* store data into this */
char *p = malloc(sizeof(strlen(arry)*char));
strcpy(p,arry);

- prashanthreddy.mtech May 28, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

obj.a = 10;
char buf[12] = "Hello World";
obj.ptr = buf;
cout << "obj.int= " << obj.a << endl;
cout << "obj.ptr= " << obj.ptr << endl;

- iwanna July 11, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <stdio.h>
struct st{
int a;
char ptr[10];
}obj;
main()
{
struct st obj= {10,"hello world"};
printf("%d,%s",obj.a,obj.ptr);
}

- ram August 25, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

l

- Anonymous October 19, 2014 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More