# Search:

Type: Posts; User: Shafiul

Page 1 of 2 1

1. ## Thread: Why is the while loop still executing?

by Shafiul
Replies
1
Views
497

### Why is the while loop still executing?

#include<stdio.h>
int main()
{
unsigned int rowIndex = 0;
int nRow = -1;
while (rowIndex < nRow)
{
printf("%d\n", rowIndex);
rowIndex++;
}
2. ## Thread: How to generate a random number in the interval of -1 and 1?

by Shafiul
Replies
17
Views
1,877

### Guys, I am sorry to be late to deliver THANKS to...

Guys, I am sorry to be late to deliver THANKS to everyone. Appreciated so much that I have learned from your code. Thanks again.
3. ## Thread: How to generate a random number in the interval of -1 and 1?

by Shafiul
Replies
17
Views
1,877

### The problem of the following formula(value = 2.0...

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...
4. ## Thread: How to generate a random number in the interval of -1 and 1?

by Shafiul
Replies
17
Views
1,877

### How to generate a random number in the interval of -1 and 1?

If R is a random number, R has to be in the interval of -1 and 1, i.e, -1<R<1. Any idea?
5. ## Thread: Is there any specific method to turn an array value from positive to negative?

by Shafiul
Replies
2
Views
680

### Is there any specific method to turn an array value from positive to negative?

Hi everyone,
Is there any specific technique to turn all of the array values from positive to negative?
6. ## Thread: Is it necessary to free an allocated variable inside a local function?.

by Shafiul
Replies
6
Views
622

### Thanks Salem and John too for comments.

Thanks Salem and John too for comments.

by Shafiul
Replies
6
Views
622

Thanks.

by Shafiul
Replies
6
Views
622

9. ## Thread: Is it necessary to free an allocated variable inside a local function?.

by Shafiul
Replies
6
Views
622

### Is it necessary to free an allocated variable inside a local function?.

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));
}

by Shafiul
Replies
4
Views
590

Alright.
11. ## Thread: Why does the statement if(arr) free(arr); still executing?

by Shafiul
Replies
4
Views
590

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...
12. ## Thread: Why does the statement if(arr) free(arr); still executing?

by Shafiul
Replies
4
Views
590

### Why does the statement if(arr) free(arr); still executing?

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...
13. ## Thread: A weird question

by Shafiul
Replies
12
Views
1,063

### Thanks Hamster_nz. Thanks Jona.

Thanks Hamster_nz. Thanks Jona.
14. ## Thread: A weird question

by Shafiul
Replies
12
Views
1,063

### Is there any way to free up the entire allocated...

Is there any way to free up the entire allocated space which was allocated inside a function of create_numbers?
15. ## Thread: A weird question

by Shafiul
Replies
12
Views
1,063

### Thanks once again for your help. I am just afraid...

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?
16. ## Thread: A weird question

by Shafiul
Replies
12
Views
1,063

### Meanwhile I am also sorry for my poor coding...

Meanwhile I am also sorry for my poor coding style. I will try to improve in near future.
17. ## Thread: A weird question

by Shafiul
Replies
12
Views
1,063

### Super useful. Thanks Amanda.

Super useful. Thanks Amanda.
18. ## Thread: A weird question

by Shafiul
Replies
12
Views
1,063

### Hi Amanda, Nice to see your feed back. I wrote a...

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...
19. ## Thread: A weird question

by Shafiul
Replies
12
Views
1,063

### A weird question

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...
20. ## Thread: Request for help

by Shafiul
Replies
4
Views
1,423

### Thanks Amanda for a nice explanation. Now It is...

Thanks Amanda for a nice explanation. Now It is clear to me. Thanks again.
21. ## Thread: Request for help

by Shafiul
Replies
4
Views
1,423

### Hi Malcolm, thanks for the answer. If I want to...

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?
22. ## Thread: Request for help

by Shafiul
Replies
4
Views
1,423

### Request for help

#include <iostream>
using namespace std;

class B
{
public:
int value;
B(){
value = 10;
}
23. ## Thread: Why does this little code consume extra bytes of memory?

by Shafiul
Replies
8
Views
1,685

### Thanks Laserlight.

Thanks Laserlight.
24. ## Thread: Why does this little code consume extra bytes of memory?

by Shafiul
Replies
8
Views
1,685

### Thanks Rstanley.

Thanks Rstanley.
25. ## Thread: Why does this little code consume extra bytes of memory?

by Shafiul
Replies
8
Views
1,685

### Why does this little code consume extra bytes of memory?

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...
Results 1 to 25 of 43
Page 1 of 2 1