[Solved] Purpose of void*

Try to compile you code with a serious ANSI C compiler, from C89 to C11, and you will get the same error: Test.c(9): error #2168: Operands of ‘=’ have incompatible types ‘double *’ and ‘int *’. Test.c(11): error #2168: Operands of ‘=’ have incompatible types ‘double *’ and ‘char *’. Test.c(13): error #2168: Operands of … Read more

[Solved] What types in C++ are enumerated types?

From cppreference: An enumeration is a distinct type whose value is restricted to one of several explicitly named constants (“enumerators”). The values of the constants are values of an integral type known as the underlying type of the enumeration. So an example of an enumerated type is any type you might declare using the enum … Read more

[Solved] What types in C++ are enumerated types?

Introduction Enumerated types, also known as enum types, are a special type of data type in C++. They are used to define a set of named constants, which can be used to represent a set of related values. Enumerated types are useful for representing a set of related values that can be used in a … Read more

[Solved] Item type from a list type c# [closed]

Based on my understanding you want to check if the type is a list and if the list’s elements is type X. You can do the following: var type = (new List<int>()).GetType(); if (type.GetInterface(“IList”) != null && type.IsGenericType && type.GenericTypeArguments.Length == 1 && type.GenericTypeArguments[0] == typeof(int)) Console.WriteLine(true); //Outputs True 3 solved Item type from a … Read more

[Solved] Check if a class is public or private

Since you already determined the type (typeof(Jedi)) you are almost there. The Type class has two properties: IsPublic and IsNonPublic. You can use them to determine the access mode of your types: public class Public { } internal class Program { private class Private { } [STAThread] private static void Main(string[] args) { Private pr … Read more

[Solved] how can i work with 16 digit integer type?

The biggest value an int can hold is 2,147,483,647. Change the variables to unsigned long long, which can hold a maximum of over 18,446,744,000,000,000,000. (You’ll need to use %llu to read in/out unsigned long long variables) Also, always validate inputs, this would have hinted at the issue. if(scanf(“%d”, &a) < 1) { //if we read … Read more

[Solved] Can I change the datatype of previously declared variable in C?

Since the pointer returned by malloc() is sufficiently well aligned to be used as a pointer to any type, you could (but probably shouldn’t) use: assert(sizeof(float) <= 10); void *data = malloc(10); char *str = data; strcpy(str, “123.4”); float *vp = data; *vp = strtof(str, NULL); …use *vp… free(data); And now you can use *vp … Read more

[Solved] A List from Property [closed]

Looking at your code the class Result is not a list which I think you are trying to call with List()? not sure.. To create a List<> you can do it multiple ways see below on a few options. Try these in your Main method. List<string> stringList = new List<string>(); //creates a List<string> called stringList … Read more