C Programming Tutorial 19, Arrays pt.4

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

awesome videos! i like to pause the video once you explain the idea, and then try and solve it myself when possible

gpps
Автор

Yeah you're right. The format %s can only be used when printing out an array of characters, it's only for use with strings.

iTzAdamX
Автор

More efficient version. Less lines, loops, variables :)

int nums[] = {1, 2, 3, 4, 5};
int i;
    for(i=4; i>-1; i--)
    printf("%d", nums[i]);
return 0;

The 'int i' can be fitted into the 'for' sequence too.  My compiler doesn't recognize it that way though.

Stanislavs
Автор

we can also write this code instead of two arrays
#include <stdio.h>
#include <stdlib.h>

int main()
{
int numbers[] ={1, 2,3,4,5};
for(int i=4;i>=0;i=i-1)
{
printf("%i\n", numbers[i]);
}
return 0;
}

jignashreddy
Автор

Hay, Adam do you think you could do some videos on Frequency and Histogram's? And Selection Sorting like bubble, insertion, ext...?

floppycooldog
Автор

Question !

In lines 10 and 11 instead of using a for Loop cant i just type :

printf ("%s", reversed);

or is it nor possible because a string can only consist of char values and not of integers or floats for examples.

SuperSamsosa
Автор

keep up the great videos! also, do you know c++ or java?

bobicemj
Автор

how do you code for the elements to appear in a triangular shape on the screen?

Torcika
Автор

[4 - i] means this:

 i = 0 so 4 - 0 = 4
 i = 1 so 4 - 1 = 3
 i = 2 so 4 - 2 = 2
 i = 3 so 4 - 3 = 1
 i = 4 so 4 - 4 = 0

djleisheng
Автор

Adam, I have a question about arrays and C. Do you have a website or email address so I can run some stuff by you? Sorry if your too busy. Keep up the good work.

damiantrevorcawood
Автор

so that's pretty much it for this tutorial, so see you guys.

OneTimWhatley
Автор

Hmm. Use the swapping Techniac. Where if i is bigger then i+1 swap

YTHandle
Автор

what does this mean 4 - i and do you know anything about sprintf()

m.mohammad
Автор

I tried this program, for me the last element is getting printed twice

lsenthil