Can C++ strings contain an infinite amount of characters provided that system memory is sufficient, and can...












0















Basically, imagine a string with a total of 10000000000000000000000000 characters. Is it possible for a string to have as many characters as such?



If it IS possible, is it possible to get the length of such a long string using string::length()?



Thanks, and I'll really appreciate it if you don't bombard this question with dislikes.










share|improve this question


















  • 1





    There are two limits: The size of the available memory (or rather the largest single chunk of available memory), and the limits of size_t. You'll run out of memory quite a while before hitting the limit of a 64-bit size_t.

    – Some programmer dude
    Nov 23 '18 at 10:23











  • What string are we talking about? std::string?

    – YSC
    Nov 23 '18 at 10:29











  • Not infinite, no. Perhaps you mean "arbitrarily large", which is finite.

    – molbdnilo
    Nov 23 '18 at 10:31






  • 1





    @Someprogrammerdude Thank you for the comment: Is 64bit size_t equal to 2^64?

    – Emirhan G.
    Nov 23 '18 at 10:33











  • That's about a hundred million times more than the estimated size (in 2014) of all data on the deep web.

    – molbdnilo
    Nov 23 '18 at 10:38
















0















Basically, imagine a string with a total of 10000000000000000000000000 characters. Is it possible for a string to have as many characters as such?



If it IS possible, is it possible to get the length of such a long string using string::length()?



Thanks, and I'll really appreciate it if you don't bombard this question with dislikes.










share|improve this question


















  • 1





    There are two limits: The size of the available memory (or rather the largest single chunk of available memory), and the limits of size_t. You'll run out of memory quite a while before hitting the limit of a 64-bit size_t.

    – Some programmer dude
    Nov 23 '18 at 10:23











  • What string are we talking about? std::string?

    – YSC
    Nov 23 '18 at 10:29











  • Not infinite, no. Perhaps you mean "arbitrarily large", which is finite.

    – molbdnilo
    Nov 23 '18 at 10:31






  • 1





    @Someprogrammerdude Thank you for the comment: Is 64bit size_t equal to 2^64?

    – Emirhan G.
    Nov 23 '18 at 10:33











  • That's about a hundred million times more than the estimated size (in 2014) of all data on the deep web.

    – molbdnilo
    Nov 23 '18 at 10:38














0












0








0








Basically, imagine a string with a total of 10000000000000000000000000 characters. Is it possible for a string to have as many characters as such?



If it IS possible, is it possible to get the length of such a long string using string::length()?



Thanks, and I'll really appreciate it if you don't bombard this question with dislikes.










share|improve this question














Basically, imagine a string with a total of 10000000000000000000000000 characters. Is it possible for a string to have as many characters as such?



If it IS possible, is it possible to get the length of such a long string using string::length()?



Thanks, and I'll really appreciate it if you don't bombard this question with dislikes.







c++ string






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 10:19









Emirhan G.Emirhan G.

25




25








  • 1





    There are two limits: The size of the available memory (or rather the largest single chunk of available memory), and the limits of size_t. You'll run out of memory quite a while before hitting the limit of a 64-bit size_t.

    – Some programmer dude
    Nov 23 '18 at 10:23











  • What string are we talking about? std::string?

    – YSC
    Nov 23 '18 at 10:29











  • Not infinite, no. Perhaps you mean "arbitrarily large", which is finite.

    – molbdnilo
    Nov 23 '18 at 10:31






  • 1





    @Someprogrammerdude Thank you for the comment: Is 64bit size_t equal to 2^64?

    – Emirhan G.
    Nov 23 '18 at 10:33











  • That's about a hundred million times more than the estimated size (in 2014) of all data on the deep web.

    – molbdnilo
    Nov 23 '18 at 10:38














  • 1





    There are two limits: The size of the available memory (or rather the largest single chunk of available memory), and the limits of size_t. You'll run out of memory quite a while before hitting the limit of a 64-bit size_t.

    – Some programmer dude
    Nov 23 '18 at 10:23











  • What string are we talking about? std::string?

    – YSC
    Nov 23 '18 at 10:29











  • Not infinite, no. Perhaps you mean "arbitrarily large", which is finite.

    – molbdnilo
    Nov 23 '18 at 10:31






  • 1





    @Someprogrammerdude Thank you for the comment: Is 64bit size_t equal to 2^64?

    – Emirhan G.
    Nov 23 '18 at 10:33











  • That's about a hundred million times more than the estimated size (in 2014) of all data on the deep web.

    – molbdnilo
    Nov 23 '18 at 10:38








1




1





There are two limits: The size of the available memory (or rather the largest single chunk of available memory), and the limits of size_t. You'll run out of memory quite a while before hitting the limit of a 64-bit size_t.

– Some programmer dude
Nov 23 '18 at 10:23





There are two limits: The size of the available memory (or rather the largest single chunk of available memory), and the limits of size_t. You'll run out of memory quite a while before hitting the limit of a 64-bit size_t.

– Some programmer dude
Nov 23 '18 at 10:23













What string are we talking about? std::string?

– YSC
Nov 23 '18 at 10:29





What string are we talking about? std::string?

– YSC
Nov 23 '18 at 10:29













Not infinite, no. Perhaps you mean "arbitrarily large", which is finite.

– molbdnilo
Nov 23 '18 at 10:31





Not infinite, no. Perhaps you mean "arbitrarily large", which is finite.

– molbdnilo
Nov 23 '18 at 10:31




1




1





@Someprogrammerdude Thank you for the comment: Is 64bit size_t equal to 2^64?

– Emirhan G.
Nov 23 '18 at 10:33





@Someprogrammerdude Thank you for the comment: Is 64bit size_t equal to 2^64?

– Emirhan G.
Nov 23 '18 at 10:33













That's about a hundred million times more than the estimated size (in 2014) of all data on the deep web.

– molbdnilo
Nov 23 '18 at 10:38





That's about a hundred million times more than the estimated size (in 2014) of all data on the deep web.

– molbdnilo
Nov 23 '18 at 10:38












4 Answers
4






active

oldest

votes


















2














It depends. std::string provides the member function max_length that returns the number of theoretically possible characters a std::basic_string may hold, irrespective of available storage, but only constrained by library implementation, bit count of basic_string::size_type or hardware limitations. A possible output on my system would be 9223372036854775807 = 263 - 1.






share|improve this answer































    1














    Object sizes are limited by the amount of addressable memory. You can treat every object as a contiguous sequence of unsigned chars, each of which have an address, so an object can only have as many constituent bytes as there are distinct char pointers. Squinting a bit harder you can argue that objects actually need to be strictly smaller than that, since you also need to be able to form a one-past-the-end pointer, but that's just a small detail. Note also that you can't form all pointer differences of overly large objects (because size is unsigned and differences are signed), so you could argue that objects should only be half as large as the addressable memory (so that all differences exist).



    The limit of the size of an object is ultimately an implementation-defined quantity (see Annex B), so implementations may have more conservative constraints than the above theoretical maximal values. For example, on segmented x86 real mode one might want to keep objects within one segment (= 64kB).






    share|improve this answer































      1














      Not within current understanding of physics.



      Within current understanding of physics, it is impossible to construct a computer with infinite memory, since doing so would require an infinite amount of energy or (equivalently) matter. The total amount of energy and matter within the known universe is finite (albeit a pretty large amount). The same goes if you believe in the multiverse - a theory that is subscribed to by some physicists and doubted by others - the total number of universes, and the energy and matter within them, is also considered to be finite (pretty large, but still finite).



      More practically, the limitations on available memory for representing a string are determined by memory physically available on a machine (large, but finite) and the size of addressable memory (which for a 64-bit system is 16 exibytes - again, large but finite). To date, there has been no system constructed with more memory than can be addressed using 64 bits.






      share|improve this answer
























      • I was asking more like can a string be as long as the memory permits. I know that it is impossible to get infinite memory, because there is no infinite amount of matter in the universe, at least that we know of.

        – Emirhan G.
        Nov 23 '18 at 20:38











      • Depends on what you mean by "memory permits". There are numerous ways for a memory allocation to fail, even if the total free memory is sufficient e.g. if the memory is fragmented and there is no free memory block of the size requested. Practically, a program that allocates/deallocates/reallocates memory (which std:strings default allocator does as strings are created and destroyed) is unlikely to allocate all available memory. There is also the opposite problem, as some systems don't commit to allocating, and use of the memory can fail even if (it seems) it was properly allocated.

        – Peter
        Nov 23 '18 at 23:58











      • Hmm, in that case, instead of trusting the auto allocation, I guess I could allocate memory for the string myself? And perhaps even somehow let my SSD be used as memory, would that be possible?

        – Emirhan G.
        Nov 24 '18 at 11:31



















      0














      Short answer, no... Nothing is infinite in a computer. Even if you create a string representation that can hold a technically infinite number of characters you also have to be able to somehow address the space that the data for those characters reside in. Since the addressable space is not infinite you will not be able to hold any data type of infinite size.






      share|improve this answer
























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444772%2fcan-c-strings-contain-an-infinite-amount-of-characters-provided-that-system-me%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        It depends. std::string provides the member function max_length that returns the number of theoretically possible characters a std::basic_string may hold, irrespective of available storage, but only constrained by library implementation, bit count of basic_string::size_type or hardware limitations. A possible output on my system would be 9223372036854775807 = 263 - 1.






        share|improve this answer




























          2














          It depends. std::string provides the member function max_length that returns the number of theoretically possible characters a std::basic_string may hold, irrespective of available storage, but only constrained by library implementation, bit count of basic_string::size_type or hardware limitations. A possible output on my system would be 9223372036854775807 = 263 - 1.






          share|improve this answer


























            2












            2








            2







            It depends. std::string provides the member function max_length that returns the number of theoretically possible characters a std::basic_string may hold, irrespective of available storage, but only constrained by library implementation, bit count of basic_string::size_type or hardware limitations. A possible output on my system would be 9223372036854775807 = 263 - 1.






            share|improve this answer













            It depends. std::string provides the member function max_length that returns the number of theoretically possible characters a std::basic_string may hold, irrespective of available storage, but only constrained by library implementation, bit count of basic_string::size_type or hardware limitations. A possible output on my system would be 9223372036854775807 = 263 - 1.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 23 '18 at 10:39









            JodocusJodocus

            5,35312037




            5,35312037

























                1














                Object sizes are limited by the amount of addressable memory. You can treat every object as a contiguous sequence of unsigned chars, each of which have an address, so an object can only have as many constituent bytes as there are distinct char pointers. Squinting a bit harder you can argue that objects actually need to be strictly smaller than that, since you also need to be able to form a one-past-the-end pointer, but that's just a small detail. Note also that you can't form all pointer differences of overly large objects (because size is unsigned and differences are signed), so you could argue that objects should only be half as large as the addressable memory (so that all differences exist).



                The limit of the size of an object is ultimately an implementation-defined quantity (see Annex B), so implementations may have more conservative constraints than the above theoretical maximal values. For example, on segmented x86 real mode one might want to keep objects within one segment (= 64kB).






                share|improve this answer




























                  1














                  Object sizes are limited by the amount of addressable memory. You can treat every object as a contiguous sequence of unsigned chars, each of which have an address, so an object can only have as many constituent bytes as there are distinct char pointers. Squinting a bit harder you can argue that objects actually need to be strictly smaller than that, since you also need to be able to form a one-past-the-end pointer, but that's just a small detail. Note also that you can't form all pointer differences of overly large objects (because size is unsigned and differences are signed), so you could argue that objects should only be half as large as the addressable memory (so that all differences exist).



                  The limit of the size of an object is ultimately an implementation-defined quantity (see Annex B), so implementations may have more conservative constraints than the above theoretical maximal values. For example, on segmented x86 real mode one might want to keep objects within one segment (= 64kB).






                  share|improve this answer


























                    1












                    1








                    1







                    Object sizes are limited by the amount of addressable memory. You can treat every object as a contiguous sequence of unsigned chars, each of which have an address, so an object can only have as many constituent bytes as there are distinct char pointers. Squinting a bit harder you can argue that objects actually need to be strictly smaller than that, since you also need to be able to form a one-past-the-end pointer, but that's just a small detail. Note also that you can't form all pointer differences of overly large objects (because size is unsigned and differences are signed), so you could argue that objects should only be half as large as the addressable memory (so that all differences exist).



                    The limit of the size of an object is ultimately an implementation-defined quantity (see Annex B), so implementations may have more conservative constraints than the above theoretical maximal values. For example, on segmented x86 real mode one might want to keep objects within one segment (= 64kB).






                    share|improve this answer













                    Object sizes are limited by the amount of addressable memory. You can treat every object as a contiguous sequence of unsigned chars, each of which have an address, so an object can only have as many constituent bytes as there are distinct char pointers. Squinting a bit harder you can argue that objects actually need to be strictly smaller than that, since you also need to be able to form a one-past-the-end pointer, but that's just a small detail. Note also that you can't form all pointer differences of overly large objects (because size is unsigned and differences are signed), so you could argue that objects should only be half as large as the addressable memory (so that all differences exist).



                    The limit of the size of an object is ultimately an implementation-defined quantity (see Annex B), so implementations may have more conservative constraints than the above theoretical maximal values. For example, on segmented x86 real mode one might want to keep objects within one segment (= 64kB).







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 23 '18 at 10:29









                    Kerrek SBKerrek SB

                    370k61695928




                    370k61695928























                        1














                        Not within current understanding of physics.



                        Within current understanding of physics, it is impossible to construct a computer with infinite memory, since doing so would require an infinite amount of energy or (equivalently) matter. The total amount of energy and matter within the known universe is finite (albeit a pretty large amount). The same goes if you believe in the multiverse - a theory that is subscribed to by some physicists and doubted by others - the total number of universes, and the energy and matter within them, is also considered to be finite (pretty large, but still finite).



                        More practically, the limitations on available memory for representing a string are determined by memory physically available on a machine (large, but finite) and the size of addressable memory (which for a 64-bit system is 16 exibytes - again, large but finite). To date, there has been no system constructed with more memory than can be addressed using 64 bits.






                        share|improve this answer
























                        • I was asking more like can a string be as long as the memory permits. I know that it is impossible to get infinite memory, because there is no infinite amount of matter in the universe, at least that we know of.

                          – Emirhan G.
                          Nov 23 '18 at 20:38











                        • Depends on what you mean by "memory permits". There are numerous ways for a memory allocation to fail, even if the total free memory is sufficient e.g. if the memory is fragmented and there is no free memory block of the size requested. Practically, a program that allocates/deallocates/reallocates memory (which std:strings default allocator does as strings are created and destroyed) is unlikely to allocate all available memory. There is also the opposite problem, as some systems don't commit to allocating, and use of the memory can fail even if (it seems) it was properly allocated.

                          – Peter
                          Nov 23 '18 at 23:58











                        • Hmm, in that case, instead of trusting the auto allocation, I guess I could allocate memory for the string myself? And perhaps even somehow let my SSD be used as memory, would that be possible?

                          – Emirhan G.
                          Nov 24 '18 at 11:31
















                        1














                        Not within current understanding of physics.



                        Within current understanding of physics, it is impossible to construct a computer with infinite memory, since doing so would require an infinite amount of energy or (equivalently) matter. The total amount of energy and matter within the known universe is finite (albeit a pretty large amount). The same goes if you believe in the multiverse - a theory that is subscribed to by some physicists and doubted by others - the total number of universes, and the energy and matter within them, is also considered to be finite (pretty large, but still finite).



                        More practically, the limitations on available memory for representing a string are determined by memory physically available on a machine (large, but finite) and the size of addressable memory (which for a 64-bit system is 16 exibytes - again, large but finite). To date, there has been no system constructed with more memory than can be addressed using 64 bits.






                        share|improve this answer
























                        • I was asking more like can a string be as long as the memory permits. I know that it is impossible to get infinite memory, because there is no infinite amount of matter in the universe, at least that we know of.

                          – Emirhan G.
                          Nov 23 '18 at 20:38











                        • Depends on what you mean by "memory permits". There are numerous ways for a memory allocation to fail, even if the total free memory is sufficient e.g. if the memory is fragmented and there is no free memory block of the size requested. Practically, a program that allocates/deallocates/reallocates memory (which std:strings default allocator does as strings are created and destroyed) is unlikely to allocate all available memory. There is also the opposite problem, as some systems don't commit to allocating, and use of the memory can fail even if (it seems) it was properly allocated.

                          – Peter
                          Nov 23 '18 at 23:58











                        • Hmm, in that case, instead of trusting the auto allocation, I guess I could allocate memory for the string myself? And perhaps even somehow let my SSD be used as memory, would that be possible?

                          – Emirhan G.
                          Nov 24 '18 at 11:31














                        1












                        1








                        1







                        Not within current understanding of physics.



                        Within current understanding of physics, it is impossible to construct a computer with infinite memory, since doing so would require an infinite amount of energy or (equivalently) matter. The total amount of energy and matter within the known universe is finite (albeit a pretty large amount). The same goes if you believe in the multiverse - a theory that is subscribed to by some physicists and doubted by others - the total number of universes, and the energy and matter within them, is also considered to be finite (pretty large, but still finite).



                        More practically, the limitations on available memory for representing a string are determined by memory physically available on a machine (large, but finite) and the size of addressable memory (which for a 64-bit system is 16 exibytes - again, large but finite). To date, there has been no system constructed with more memory than can be addressed using 64 bits.






                        share|improve this answer













                        Not within current understanding of physics.



                        Within current understanding of physics, it is impossible to construct a computer with infinite memory, since doing so would require an infinite amount of energy or (equivalently) matter. The total amount of energy and matter within the known universe is finite (albeit a pretty large amount). The same goes if you believe in the multiverse - a theory that is subscribed to by some physicists and doubted by others - the total number of universes, and the energy and matter within them, is also considered to be finite (pretty large, but still finite).



                        More practically, the limitations on available memory for representing a string are determined by memory physically available on a machine (large, but finite) and the size of addressable memory (which for a 64-bit system is 16 exibytes - again, large but finite). To date, there has been no system constructed with more memory than can be addressed using 64 bits.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Nov 23 '18 at 11:01









                        PeterPeter

                        28k32257




                        28k32257













                        • I was asking more like can a string be as long as the memory permits. I know that it is impossible to get infinite memory, because there is no infinite amount of matter in the universe, at least that we know of.

                          – Emirhan G.
                          Nov 23 '18 at 20:38











                        • Depends on what you mean by "memory permits". There are numerous ways for a memory allocation to fail, even if the total free memory is sufficient e.g. if the memory is fragmented and there is no free memory block of the size requested. Practically, a program that allocates/deallocates/reallocates memory (which std:strings default allocator does as strings are created and destroyed) is unlikely to allocate all available memory. There is also the opposite problem, as some systems don't commit to allocating, and use of the memory can fail even if (it seems) it was properly allocated.

                          – Peter
                          Nov 23 '18 at 23:58











                        • Hmm, in that case, instead of trusting the auto allocation, I guess I could allocate memory for the string myself? And perhaps even somehow let my SSD be used as memory, would that be possible?

                          – Emirhan G.
                          Nov 24 '18 at 11:31



















                        • I was asking more like can a string be as long as the memory permits. I know that it is impossible to get infinite memory, because there is no infinite amount of matter in the universe, at least that we know of.

                          – Emirhan G.
                          Nov 23 '18 at 20:38











                        • Depends on what you mean by "memory permits". There are numerous ways for a memory allocation to fail, even if the total free memory is sufficient e.g. if the memory is fragmented and there is no free memory block of the size requested. Practically, a program that allocates/deallocates/reallocates memory (which std:strings default allocator does as strings are created and destroyed) is unlikely to allocate all available memory. There is also the opposite problem, as some systems don't commit to allocating, and use of the memory can fail even if (it seems) it was properly allocated.

                          – Peter
                          Nov 23 '18 at 23:58











                        • Hmm, in that case, instead of trusting the auto allocation, I guess I could allocate memory for the string myself? And perhaps even somehow let my SSD be used as memory, would that be possible?

                          – Emirhan G.
                          Nov 24 '18 at 11:31

















                        I was asking more like can a string be as long as the memory permits. I know that it is impossible to get infinite memory, because there is no infinite amount of matter in the universe, at least that we know of.

                        – Emirhan G.
                        Nov 23 '18 at 20:38





                        I was asking more like can a string be as long as the memory permits. I know that it is impossible to get infinite memory, because there is no infinite amount of matter in the universe, at least that we know of.

                        – Emirhan G.
                        Nov 23 '18 at 20:38













                        Depends on what you mean by "memory permits". There are numerous ways for a memory allocation to fail, even if the total free memory is sufficient e.g. if the memory is fragmented and there is no free memory block of the size requested. Practically, a program that allocates/deallocates/reallocates memory (which std:strings default allocator does as strings are created and destroyed) is unlikely to allocate all available memory. There is also the opposite problem, as some systems don't commit to allocating, and use of the memory can fail even if (it seems) it was properly allocated.

                        – Peter
                        Nov 23 '18 at 23:58





                        Depends on what you mean by "memory permits". There are numerous ways for a memory allocation to fail, even if the total free memory is sufficient e.g. if the memory is fragmented and there is no free memory block of the size requested. Practically, a program that allocates/deallocates/reallocates memory (which std:strings default allocator does as strings are created and destroyed) is unlikely to allocate all available memory. There is also the opposite problem, as some systems don't commit to allocating, and use of the memory can fail even if (it seems) it was properly allocated.

                        – Peter
                        Nov 23 '18 at 23:58













                        Hmm, in that case, instead of trusting the auto allocation, I guess I could allocate memory for the string myself? And perhaps even somehow let my SSD be used as memory, would that be possible?

                        – Emirhan G.
                        Nov 24 '18 at 11:31





                        Hmm, in that case, instead of trusting the auto allocation, I guess I could allocate memory for the string myself? And perhaps even somehow let my SSD be used as memory, would that be possible?

                        – Emirhan G.
                        Nov 24 '18 at 11:31











                        0














                        Short answer, no... Nothing is infinite in a computer. Even if you create a string representation that can hold a technically infinite number of characters you also have to be able to somehow address the space that the data for those characters reside in. Since the addressable space is not infinite you will not be able to hold any data type of infinite size.






                        share|improve this answer




























                          0














                          Short answer, no... Nothing is infinite in a computer. Even if you create a string representation that can hold a technically infinite number of characters you also have to be able to somehow address the space that the data for those characters reside in. Since the addressable space is not infinite you will not be able to hold any data type of infinite size.






                          share|improve this answer


























                            0












                            0








                            0







                            Short answer, no... Nothing is infinite in a computer. Even if you create a string representation that can hold a technically infinite number of characters you also have to be able to somehow address the space that the data for those characters reside in. Since the addressable space is not infinite you will not be able to hold any data type of infinite size.






                            share|improve this answer













                            Short answer, no... Nothing is infinite in a computer. Even if you create a string representation that can hold a technically infinite number of characters you also have to be able to somehow address the space that the data for those characters reside in. Since the addressable space is not infinite you will not be able to hold any data type of infinite size.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 23 '18 at 10:33









                            inquaminquam

                            7,659134691




                            7,659134691






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444772%2fcan-c-strings-contain-an-infinite-amount-of-characters-provided-that-system-me%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                Alcedinidae

                                RAC Tourist Trophy