Anonymous
/report
Anonymous
http://p.ip.fi/9ShS when i run it it returnes: plato: Invalid argument
User404
Umm... I have a question.(C) 1.Why can't an array be assigned value after being declared? 2.Is it necessary to initialize the array while declaring to store value in it if I don't want to use strcpy ()? (Just wanted to know if any other way existed) 3. (Last question) Can I declare and initilaize an array inside a decision control box? Thanks in advance :-)
User404
In case of 'char' ?
Daniele
Can you please be more elaborate. Sorry for troubling you.
for (i = 0; i < ARRAY_SIZE; i++) { array[i] = someValue; }
Daniele
this fills the array with the variable someValue without you having to write the initialization fully
User404
O i get it Thanks a bunch
Anonymous
#include<stdio.h> #include<stdlib.h> struct array { int A[10]; int size; int length; }; void display (struct array s) { int i ; for(i=0;i<s.length;i++) { printf("%d ",s.A[i]); } } void append (struct array *p,int x) { if(p->length<p->size) { p->A[p->length++]=x; } } void insert (struct array *p,int index,int x) { int i; if(index>=0 && index<=p->length) { for(i=p->length;i>index;i--) p->A[i]=p->A[i-1]; p->A[index]=x; p->length++; } } int main() { struct array s={{1,2,3,4,5},10,5}; insert(&s,3,7); display(s); return 0; }
Anonymous
will this be better way of inserting array
Anonymous
or without using pointers and structure would be fine?
Kenny
I'd use dynamic array
Anonymous
list with malloc, allocate a block of memory one time
Daniele
O i get it Thanks a bunch
mind you, ARRAY_SIZE is not a const int in C, it has to be a define or a number iirc
Daniele
in C++ you can use a const int
Vlad
Even more so, you can use VLA
Daniele
I assumed c89 for some reason
Daniele
they thought us strict standard c89
Daniele
so it stuck with me. It's always a wonder being able to use // for line comments or declaring indexes inside for loops
Anonymous
Ok..sorry...i just wanted to help..
Emmanuel
Follow my Instagram page @ #MVP3589 for mind blowing nudes, videos and hookups nation wide
harun
perfect
Emmanuel
😂😂
Anonymous
oof did i fall for a meme or something?
Emmanuel
oof did i fall for a meme or something?
😂😂😂😂😂😂😂😂😂
Anonymous
Emmanuel
Hahahaahaha
Ибраги́м
oof did i fall for a meme or something?
Checkout the links next time
Ибраги́м
😂😂😂😂😂😂😂😂😂
And you're a pathetic troll!
Ибраги́м
You should be flogged 260 times
Ибраги́м
With no rest
Ибраги́м
And should made to compile a large C++ code base by making the assembly with Notepad, while your legs are tied with your earpiece!
Renan
The only place Java is not used is in nuclear power plants.
The government seems to love Java. 😅 👍
Dima
ewww java
Renan
ewww java
I do not make the TIOBE index. If people could choose instead of following market demands, what language would they elect? Or what tools will they use for personal projects? 🤔
Dima
Idk. people want easy money
Mar!o
This group is trash .. Nothing to lean or gain here .. No coding, no programing or c++ related issue
I agree somehow. We should have better issues than just the standard how to learn C++ beginner stuck where the answer is always the same
Mar!o
I created a C++ experts group. I wanted to send the link... how can I share it now?
Dima
its here already, no?
Dima
you should’ve asked lol
Dima
hold on
Mar!o
Bruh... xD
Mar!o
Where can I see my warnings and how many I've left?
Mar!o
labyrinth
I was asked in the interview, about what to take care of when trying to send a struct over a network, between a windows and Linux machine, assuming that the receiver knows how it is structured. I answered on care in 32/64 bit data type difference, big and little median. But the interviewer seem to expect more... could anyone elaborate?
Anonymous
Os might provide library function transfer between host byte order and network byte order, like linux htons
Vlad
Also alignment
labyrinth
But I assume that the struct always comply to memory alignment automatically isn’t it?
Vlad
But I assume that the struct always comply to memory alignment automatically isn’t it?
But it doesn't mean that they will match on different pc's if you send it via network
labyrinth
Oh, you mean one can interpret the bytes differently? I didn’t read about this details🙈 but I get to know that the memory padding on struct might work differently on different compilers.
Vlad
On different machines
Anonymous
Hi
Z0OM
i have a vector of union. if i want to iterate and print all values. how can i achieve it?
Vlad
Ignore for_each boilerplate.
Vüqar
Hello. My project was ready, but there are a couple of shortcomings: 1.Kart 2. Types of cards 3. Save the card in a file Please help. Thanks
Dima
/ban homework
rüde
Roxifλsz 🇱🇹
I am right and you know it
Roxifλsz 🇱🇹
Vlad
you are left
He is (-1, 0)
Vlad
To be exact
harun
omg stop pls plz please
Anonymous
hi fima
Anonymous
dima 😂😂
Anonymous
I wanted to say good morning