Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Ajuda com vetor...


Fpslevelup
 Share

Question

O codigo funciona bem porem quando peço para imprimir ele mostra a posição na memoria não o que é pedido...

#include <stdio.h>
#include <stdlib.h>
int main(){
int valor[10];
int i;
for(i=0 ; i < 10 ; i++){
printf("Digite um valor: ");
scanf("%d", &valor);
}
for(i=0 ; i < 6 ; i++){
printf("\nPosicao %d: %d\n", i, &valor);
}
system("pause");
return 0;
}
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Olá!

Não sei se já conseguiu resolver o problema, mas . . . veja se isso resolve o seu problema:

printf("\nPosicao %d: %d\n", i, valor[i]);

Com valor [ i ], sem o " & "

Ubuntu 14.04 GNU GCC 4.8 CodeBlocks 13.12

Espero Ter Ajudado ! ! !

Link to comment
Share on other sites

Join the conversation

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

Guest
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.

 Share



  • Forum Statistics

    • Total Topics
      150.1k
    • Total Posts
      647.1k
×
×
  • Create New...