Hi guys, I have a question about an idea for an university project.
Based of the Mars idea (it's a mips32 simulator, here's a screenshot: http://tinyurl.com/qdforvk ) I was thinking about a similar...
Type: Posts; User: root
Hi guys, I have a question about an idea for an university project.
Based of the Mars idea (it's a mips32 simulator, here's a screenshot: http://tinyurl.com/qdforvk ) I was thinking about a similar...
Procedure print_person_info
The print person procedure is wrong, the printf prints "Name = %s %s, person.first_name, person.last_name" instead of you want to print, here some example printf - C++...
My idea for doing the test was:
#include <stdio.h>
#include <string.h>
int main(void){
Give a look to:
strcat - C++ Reference
strcmp - C++ Reference
Because the project must have communicating processes (it's an Operating System project) and I think this is a good case where use them.
Btw thanks @anduril462 for your ideas. I've edited the...
Hi, I'm trying to solve a problem with my project, in the assignment I just have 2 requirements:
-client server
-communicating processes
and as project I've done a client-server poker app in C,...
Are there restriction about the number of parameters of the function?
if not, the solution is easier that the posted up there, and the problem can be formulated as follow:
Write a recursive...
Pay attention with fgets:
-Fgets automatically add the terminating null char after reading maximum N-1 chars.
-Fgets returns a char*(or NULL) so you can't call it with an int variable (zip)
-why...
This is a better solution, in this way if there aren't swaps(so it means that is ordered) it stops.
Said formally, in the best case the time complexity of this implementation in 0(n) instead of...
You're welcome :)
I don't know how to give a hint, I'm trying to explain it in a high level pseudocode
function print_stack(stack s)
if the stack isn't empty then
...
I don't really think that this exercise may help you to pass an exam 2 hours before it..
int i,j;
for(i=5,j=1;i>0;i--,j++) printf("%d\n%d\n",i,j);
or you can put them in an array and print them, what they rapresent?
Before saying "how" it's also important understand "why" I've said that.
So,now you have an ADT stack with just a print function, suppose that you want to add functions to find max and min, to add...
I'm not sure that your code is correct, in a stack you can't access to an element without have done the pop of the previous elements.
your print function scans the stack like a linked list.
Right observation :), if you want to exit if the allocation fails you can call the exit function writing
exit(1);
why don't you use a recursive function to print elements?
It became easier and you can do it without modify the stack.
you have to allocate memory for a string, you dont' need buff variable
Try
lunch[x].name=malloc(50*sizeof(char));
/*I'm assuming that the food name is shorter than 50 characters, write ...
Be careful,
line 17: you've declared an array of struct of 5 elements, you can access to element with 0≤indexf≤4 , there's an out of bound
It's more versatile to define a structure tag or...
use a float a make a cast when you divide
float quotient;
.....
quotient = (float)first_Num / sec_Num;
printf("\nThe quotient of %d and %d is %f\n\n", first_Num, sec_Num, quotient);
first of all thank you for the answer :),
I've given a look to the contents, it seems a lot theoretical, what I'm looking for is a book or everything for the lab part, the implementation in C of...
yes, an array isn't passe by value, there's an implicit conversion array-pointer and in the function you have a pointer to the first element, in fact in the function write array[3] or *(array+3) is...
now it should work
Hi all, I'm a computer science student, I've opened this thread to ask you a title of book/ebook/site/etc where I can find exercises solved of C data structures.
At my Algorithms course we use as...