0

phonebook is an array of pointers.

inside the handleMenu im allocating memory and pointing to structure where a first name is assigned to a struct that is pointed from phonebook[11].

enter image description here

as you can see in line 54, the name is assigned correctly and the program remembers it when exiting the handleMenu function, and i can access the details of the structure.

but after going down 1 line and ending the main while loop, the value suddenly changes.

enter image description here

what causes it and how to solve it? i want to remember the address to the structure but it seems that it wont save.

thanks in advance!

1 Answer 1

0

check this first:while(option < 1 && 7 < option) this condition will never happen! be sure from this. when you trying to assign array of pointer type structs it should be allocated first .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.