Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
Samuel Magalhães

como imprimir uma lista usando string


Buenas pessoal

Tenho que escrever um codigo que imprima lista de pratos, porem não sei como imprimir usando string, abaixo o codigo que fiz usando int para testar o codigo, se rodar ele vão ver que funciona.



#include <stdio.h>

int main(void){

    struct lista {
                  int prato;
                  struct lista *proximo;

    struct lista p1, p2, p3, p4, p5;
    struct lista *inicio = &p1;

    p1.prato = 5;//"Risotos de Milao";
    p2.prato = 10;//"Bruschetta";
    p3.prato = 15;//"Alcachofras Romanas";
    p4.prato = 20;//"Tortellini de Bolonha";
    p5.prato = 25;//"Carpaccio";

    p1.proximo = &p2;
    p2.proximo = &p3;
    p3.proximo = &p4;
    p4.proximo = &p5;
    p5.proximo = (struct lista *)0;

    while(inicio != (struct lista *)0){
        printf("%i\n", inicio->prato);
        inicio = inicio->proximo;


    return 0;


Share this post

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

Cloud Computing

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...