Siemens 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

I think you can use calloc here.
As malloc will initialize this array to garbage value, once memory is created.
But calloc will initialized to NULL

- Prashanth January 28, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You would need to know the size of the array somehow

- Dave January 28, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void FunPassDoublePointer(char *chErrArr[])
{
	// here by incrementing the chErrArr pointer you can get strings corresponding to errors
	chErrArr++;
}
void main()
{
	char chArr1[] = "Error 1 occured";
	char chArr2[] = "Error 2 occured";
	char chArr3[] = "Error 3 occured";


	char *chErrorArr[] = {chArr1,chArr2,chArr3};
	char **pchArr = NULL;
	pchArr = chErrorArr;
	void FunPassDoublePointer(char *chErrArr[]);
	FunPassDoublePointer(pchArr);
}

- Jitendra Singh February 06, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

void FunPassDoublePointer(char *chErrArr[]); is not needed in main

- Jack Wood February 09, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

yes Jack Wood , you are right..

- Jitendra Singh February 10, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

int main(int argc, char *argv[])
{
    char ** mychar = new char *[5];
    for(int i=0; i<5; i++)
    {
            mychar[i] = new char[5];
            memset(mychar[i],'0',5);        
    }
    for(int j=0; j<5; j++)        
    {
                cout<<mychar[j]<<endl;
    }
    
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

- aap.shweta July 10, 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