#include<stdio.h>
int main()
{
unsigned int rowIndex = 0;
int nRow = -1;
while (rowIndex < nRow)
{
printf("%d\n", rowIndex);
rowIndex++;
}
Type: Posts; User: Shafiul
#include<stdio.h>
int main()
{
unsigned int rowIndex = 0;
int nRow = -1;
while (rowIndex < nRow)
{
printf("%d\n", rowIndex);
rowIndex++;
}
Guys, I am sorry to be late to deliver THANKS to everyone. Appreciated so much that I have learned from your code. Thanks again.
The problem of the following formula(value = 2.0 * (rnumber - 0.5)), it provides sometimes -1 or +1 once the rnumber is 0 or 1.
#include<stdio.h>
#include<iostream>
int main()
{
float...
If R is a random number, R has to be in the interval of -1 and 1, i.e, -1<R<1. Any idea?
Hi everyone,
Is there any specific technique to turn all of the array values from positive to negative?
Thanks Salem and John too for comments.
Thanks.
Thanks Amanda for your comments.
Do I need to free variable 'var' inside of local function func()?.
#include<stdio.h>
#include<stdlib.h>
void func()
{
int* var = (int*)malloc(sizeof(*var));
}
Alright.
Thank you very much for your answer. Appreciated. However, wondering part is, why is the if(arr) expression returning a true value!. It should not return a true value after executing free(ptr). Sorry...
Hello everyone, I have a heap allocated array arr. The allocation in arr is freed by using a pointer ptr. Therefore, if(arr) statement should return a false value. But practically it returns a true...
Thanks Hamster_nz. Thanks Jona.
Is there any way to free up the entire allocated space which was allocated inside a function of create_numbers?
Thanks once again for your help. I am just afraid to ask, does free(numbers) actually free the first element of result array or all the elements?
Meanwhile I am also sorry for my poor coding style. I will try to improve in near future.
Super useful. Thanks Amanda.
Hi Amanda, Nice to see your feed back. I wrote a sample program for one test case. However, for some reason, I can not declare the array or allocate a pointer with a specific size in the main...
Is there any way to declare an array inside main function but initialization of this array will be into another function (out of main function)?. If possible, after initialization, is there any...
Thanks Amanda for a nice explanation. Now It is clear to me. Thanks again.
Hi Malcolm, thanks for the answer. If I want to share the updated value of object owned by main to the object owned by class A, what should I do?
#include <iostream>
using namespace std;
class B
{
public:
int value;
B(){
value = 10;
}
Thanks Laserlight.
Thanks Rstanley.
In the following program, the structure object nd[0] node consumed 8 bytes of memory. Ideally, nd[0] should consume 5 bytes of memory in total. I mean, 4 bytes for Int type + 1 byte for the char...