Hsn
coal
coal
a state machine will allow you to read the input and have a meaningful context of what you're expecting to parse
coal
for example, you could start in a state 0 to read a value and 1 for operators, then based on that context you can classify the characters you're reading to serialize them into something you can work with
Hima
Hsn
?
It wont parse negative number .. first number is negative not an operator
Hima
Anonymous
Hey guys, I saw a really weird form of an IF statement. It's condition part has a block statement. it looks like the following code segment.
if (({int a = 0; int b = a + 3; b > 0;})) {
// do whatever you want
}
My question is "How this could work?"
, I never saw an IF condition part have a block statement before...😰
Suka
Igor🇺🇦
Anonymous
Thanks for all your explanations.👏
itsmanjeet
I have a vector<int> of size(1024)
Then i take the iterator
vector<int>::iterator Iter = vec.begin()
Then what i know is
Iter == pointer to the first value (currently)
*Iter == first value
Then what the Iter[0] denotes
Pavel
itsmanjeet
Ok mean
vec = [1, 2, 3, 4]
iter = vec.begin() + 2
iter[0] = 3
iter[1] = 4
iter[-1] = 2
If i understand the thing correctly ?
Pavel
itsmanjeet
itsmanjeet
Thanks
Yamu
Hello guys I am a newbie here
Yamu
I have a problems with c programming
Yamu
#include<stdio.h>
int main(){
int i; //used to count loop
int n; //Size of array
int position; //The array location where you want to delete
int array[n];
//let user to input the size of array
printf("1.Please input the size of array n:");
scanf("%d",&n);
//let user input the element of array
printf("2.Please input the elements of array:\n");
for(i=0; i<n; i++){
printf("Array[%d]: ",i);
scanf("%d",&array[i]);
}
n = n-1; //Decrease a speac of array after deletion
for(i=n-1; i>=position; i--){
array[i-1] = array[i];
}
printf("The result after deletion is:");
for(i=0; i>n; i++){
printf("Array[%d] = %d", i, array[i-1]);
}
return 0;
}
Yamu
when i output it, it show nothing
Yamu
--------------------------------
Process exited after 4.59 seconds with return value 3221225725
Press any key to continue . . ..
Yamu
There is no error occur when i compiled it
Yamu
Please help me! : )
Ethan
Ethan
Your loop logic is off, try rethinking a better solution
Pavel
Yamu
Thank You guys for your helping!!
Yamu
I will try it as you guys told thank you..
Null
!report
\Device\NUL
\Device\NUL
That's not how dynamic array works in C, stack allocated array once its created, it can't be resized
\Device\NUL
Please don't PM Teb
Yamu
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi guys, happy holidays;
I'm writing a program and I have the need to delete one element from an array of integers in C. My question is: do I need to use dynamic memory management? Because that seems pretty fair to me to be honest, but I've seen some tutorials on the internet that don't use realloc() or any other dynamic Memory management function. So I'm a little bit confused
Yamu
let me try it thank you
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi guys, happy holidays;
I'm writing a program and I have the need to delete one element from an array of integers in C. My question is: do I need to use dynamic memory management? Because that seems pretty fair to me to be honest, but I've seen some tutorials on the internet that don't use realloc() or any other dynamic Memory management function. So I'm a little bit confused
Like, if my array is
Int *arr= (1,2,3,4,5}
And I want to remove 2,3 I have
arr= {1,4,5}
But now the array is smaller. So it does fit in the previous memory region allocated for it when declaring the array, but I'm wondering if this could lead to problems in much more complex softwares
\Device\NUL
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Ok so basically I'm just saying that since I'm reducing array size it will surely fit the memory region allocated earlier
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
mahdi13
Hello
In the switch, I want to check two values in a case like this
case 'a' || 'A':
...
break;
If the user enters a or A, this case will run, but as I wrote, it don't work
how can I do that?
writ separate case for each one?
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
\Device\NUL
mahdi13
Hades
decltype vs auto, what's the difference?
Ömer Faruk Aydın
Hello there, i have a question: I've been working on swapping 2 words in a string.(In C language) However using another array is not allowed. Basically code should look something like this: int main()
{
char str[SIZE];
printf("Enter 2 words: ");
sgets(str);
printf("[%s]\n", str); // [hello friend]
//code
printf("[%s]\n", str); // [friend hello]
}
Ömer Faruk Aydın
Ömer Faruk Aydın
I'd really appreciate if anyone can give me tips for the algorithm
S__R
João
Hi
João
Anyone can help me?
Prince Of Persia
is there anyway to get all input from a istream object as iterators or as string ? (without getting line by line in while loop)
Prince Of Persia
Prince Of Persia
But two or three times slower than getting line by line
Anonymous
how can I read the numbers in keyboard with c
Morsal
Hi all, I have question.
What computers that used by giant companies such as Google and Facebook?
Cri | ferrosxlupus
Anonymous
you can use
printf("Enter a number: "); scanf("%d", &a);
Cri | ferrosxlupus
Anonymous
Anonymous
Ludovic 'Archivist'
They have the money that affords these amounts of cost optimization. On the other side of the spectrum, I can only use the best tools available *to me* for the job, which is often X86_64 and AVR or some suboptimal flavour of ARM
Ludovic 'Archivist'
😭
Morsal
L.Ashurmatov
Hi, everyone
How to find time implementation of code in c programming language
For example cpp have a library ctime to find implementation time but I didn't find in c programming language?
For instance
In python for that have time library
Start = time.time()
..
..
End = time.time()
In the end
End - start if I'm not mistaken
Suka
Suka
?
@SilhouetteInDark why do you think are function declarations there in C and C++ ? why we need to write a function declaration on top of a function call when the actual function definition is below that function call
L.Ashurmatov
Ömer Faruk Aydın
Vishal
Given a string, how many different substrings exist
in it that have no repeating characters? Two
substrings are considered different if they have a
different start or end index.
Example
S = "abac"
The substrings that have no repeating characters in
them are "a", "b", "a", "c", "ab", "ba", "ac", and "bac".
Note that "aba" and "abac" do not qualify because
the character 'a'is repeated in them. Also note that
two substrings, "a" and "a", both qualify because
their start indices are different: s[0] and s[2]. There
are 8 substrings that have no repeating characters.
crintion
ho ritor